Description Usage Arguments Examples
This function creates an index or count variable by group, optionally sorting on an additional parameter of interest. For example, one may create an index/ranking of income within some group, e.g. the median income of census tracts within counties of a state. Or, one may create a static count within some grouping variable, e.g. class size within a dataframe of test scores.
1 |
df |
character; an R |
grp |
character; a grouping variable, such as a subject number, a classroom, a county, etc. |
sortvar |
character; sorts the data within grp (see above) by an additional variable (e.g., mpg within cyl in matcars). If no variable df is specified, data are sorted by grp. |
output |
character; what type of output is desired, a within group "index" (the default) or a "count" within grp? |
desc |
logical; when |
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.