Description Usage Arguments Value Examples
This function creates a multiple boxplot that shows the distribution of a numeric variable in each different category contained in a categorical variable. This function will remove any NA values in the data prior to creation of the boxplot.
1 | boxplot_numeric_category(dataframe, x, y)
|
dataframe |
The dataframe that contains the variables that you would like to use to create the boxplot. The class of this parameter must be dataframe. This argument was named dataframe because the variable that needs to be input here must have a dataframe class type, so users will instantly know what type of variable to include for this argument. |
x |
The categorical variable containing the categories that we want to plot the distribution of a numeric variable across. x must be a vector of class character or factor. This parameter was named x because it is the variable that is plotted on the x axis, and most users would be used to "x" being used to represent the x axis variable, so this argument name would be familiar to users. |
y |
The numeric variable that we want to examine the distribution of across a categorical variable. y must be a vector of class double, integer, or numeric. This parameter was named y because it is the variable that is plotted on the y axis, and most users would be used to "y" being used to represent the y axis variable, so this argument name would be familiar to users. |
A single panel multiple boxplot showing the distribution of the variable y in each category contained in the variable x.
1 2 3 4 5 6 7 8 | ## Using the "CO2" dataset from the r "datasets" package, create a boxplot that shows the distribution of CO2 concentration of grass plants in each treatment type (chilled or nonchilled)
boxplot_numeric_category(dataframe = CO2, x = Treatment, y = conc)
## Using the "starwars" dataset from the dplyr package,create a boxplot that shows the distribution of the height of starwars characters based on the sex of the characters
starwars %>% boxplot_numeric_category(sex, height)
## Using the "storms" dataset from the dplyr package, create a boxplot that shows the distribution of the wind speeds observed for each of the storms Caroline and Doris
boxplot_numeric_category((storms %>% filter(name == c("Amy", "Doris"))), name, wind)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.