prop | R Documentation |
prop
returns proportion to sum of entire x
. prop_col
returns proportion to sum of each column of x
. prop_row
returns
proportion to sum of each row of x
. Non-numeric columns in the
data.frame are ignored. NA's are also ignored.
prop(x)
prop_col(x)
prop_row(x)
x |
numeric vector/matrix/data.frame |
the same structure as x
but with proportions of original
values from sum of original values.
a = c(25, 25, NA)
prop(a)
# data.frame with non-numeric columns
fac = factor(c("a", "b", "c"))
char = c("a", "b", "c")
dat = as.POSIXct("2016-09-27")
a = sheet(fac, a = c(25, 25, NA), b = c(100, NA, 50), char, dat)
prop(a)
prop_row(a)
prop_col(a)
# the same as result as with 'prop.table'
tbl = table(state.division, state.region)
prop(tbl)
prop_row(tbl)
prop_col(tbl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.