View source: R/plotting_misc.R
addNCountColumn | R Documentation |
This function returns a tidy data set with one addition column which contains a variable name with the counts appended. As an example, suppose you had 10 observations of category (column named your_category) 'A' and 12 observations of category 'B'. The output will add this additional column: your_category. <chr> A\n(n=10) B\n(n=12)
addNCountColumn(dataSet, countField, addNewline = T)
addNewline |
Optional: Add a newline between the category name and the variable count, defaults to true |
dataSet: |
A tidy data set |
countField: |
A column to use for counting |
This is most useful for making a new categorical variable name to pass to a ggplot bar/box plot.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.