1 | arep(x, MARGIN = 1)
|
x |
|
MARGIN |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, MARGIN = 1)
{
if (length(dim(x)) == 1) {
ret <- cbind(N = x, pct = 100 * x/sum(x, na.rm = T))
ret <- rbind(ret, Total = apply(ret, 2, sum, na.rm = T))
print(round(ret, 1))
return(invisible(ret))
}
ret <- list(N = atotal(x), pct = 100 * acond(x, MARGIN))
cat("\nN:\n")
print(ret[[1]])
cat("\nPercentage:\n")
print(round(ret[[2]], 1))
invisible(ret)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.