ez.count | R Documentation |
count within one or more than one columns/rows, or entire data frame (ie, all columns/rows)
ez.count(x, val = NA, col = NULL, dim = 3)
x |
data frame or vector, if vector, parameters col, dim are ignored |
val |
value to be counted, could be NA. Note, may not differentiate 5.0 and 5, ie. 5.0==5 TRUE |
col |
column evaluated by eval('dplyr::select()'), single or vector. If NULL, all columns used |
dim |
1=along row (rowwise), 2=along col (colwse), 3=area, both, grand total (within specified cols/rows) |
returns a data frame, if dim=1/2; a single value if dim=3.
vector input x always outputs a single value.
ez.countif
sx = c("F", "F", "F", "M", "M", "M")
ht = c(69, 64, 67, 68, 72, 71)
wt = c(148, 132, 142, 149, 167, 165)
people = data.frame(sx, ht, wt)
ez.count(people,'M',dim=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.