Plot a boxplot with the magma color scheme and an option to facet.

boxplot(df, x, y, facet = FALSE)

Arguments

df

Dataframe containing the variables for plotting

x

Column name of the categorical variable to view the distribution of

y

Column name containing the numerical variables to assign boxes to

facet

Determines whether separate graphs will be created for each category

Value

a ggplot object

Examples

penguins_data <- palmerpenguins::penguins
boxplot(penguins_data, species, flipper_length_mm, facet = TRUE)
#> Loading required package: viridisLite
#> Warning: package ‘rlang’ was built under R version 4.1.2
#> 
#> Attaching package: ‘rlang’
#> The following objects are masked from ‘package:purrr’:
#> 
#>     %@%, as_function, flatten, flatten_chr, flatten_dbl, flatten_int,
#>     flatten_lgl, flatten_raw, invoke, splice
#> Warning: Removed 2 rows containing non-finite values (stat_boxplot).