Description Usage Arguments Value Examples
Created to count the number of people in a certain age range. Function tested using a data frame with continuous age values in one column, and counts of people in another column.
1 | group2(x, group_of, FUN = "sum", age_labels = F)
|
x |
A dataframe |
group_of |
The range to group together. |
FUN |
A string of the function to be performed in the aggregate section. Default = "sum" |
age_labels |
Logical. If true, age labels are attempted. Only works if 1st age group starts at 0. |
A dataset that has been groupped by group_of
and has had
FUN
perfomed on the grouping.
1 2 3 4 | ### Sum the number of men in each user defined age group
# create data
x <- data.frame(age = c(1:6), males = c(0,1,0,2,3,5), females = c(4,6,2,1,0,1))
group2(x, 3, "sum")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.