# \donttest{
## cant have examples if function not in namespace - i.e. without export
## so comment all out for own use
# dn <- LETTERS[1:4]
# P <- matrix(data = c(1000, 100, 10, 0, 55, 555, 50, 5, 80, 40, 800, 40, 20, 25, 20, 200),
# nrow = 4, ncol = 4, dimnames = list(pob = dn, por = dn), byrow = TRUE)
# # display with row and col totals
# addmargins(A = P)
#
# # no change
# y <- nb_non_zero(m = P)
# addmargins(A = y)
#
# # adjust a native born population to negative
# P[4, 4] <- -20
# # display with row and col totals
# addmargins(A = P)
#
# y <- nb_non_zero(m = P)
# addmargins(A = y)
# }
Run the code above in your browser using DataLab