dplyr in R
How to Use ungroup() in dplyr (With Examples)
You can use the ungroup() function in dplyr to ungroup rows after using the group_by() function to summarize a variable by group.
The following example...
ggplot2 in R
How to Label Outliers in Boxplots in ggplot2
This tutorial provides a step-by-step example of how to label outliers in boxplots in ggplot2.
Step 1: Create the Data Frame
First, let’s create the following...
ggplot2 in R
How to Add Caption to ggplot2 Plots (3 Examples)
You can use the following methods to add a caption to plots in ggplot2:
Method 1: Add Caption in Default Location
p +
labs(caption =...
ggplot2 in R
How to Change the Order of Facets in ggplot2 (With Example)
You can use the following basic syntax to specify the order of facets in ggplot2:
p +
facet_grid(~factor(my_variable, levels=c('val1', 'val2', 'val3', ...)))
The following example...
ggplot2 in R
How to Group by Two Columns in ggplot2 (With Example)
You can use the following basic syntax to group by two columns when creating a plot in ggplot2:
ggplot(df, aes(x=var1, y=var2, color=var3, shape=var4,
...
dplyr in R
How to Select Rows of Data Frame by Name Using dplyr
You can use the following syntax to select rows of a data frame by name using dplyr:
library(dplyr)
#select rows by name
df %>%
filter(row.names(df) %in%...
dplyr in R
How to Arrange Rows by Group Using dplyr (With Examples)
You can use the following methods to arrange rows by group in dplyr:
Method 1: Arrange Rows in Ascending Order by Group
library(dplyr)
#arrange rows in ascending...
Subscribe
- Never miss a story with notifications
- Gain full access to our premium content
- Browse free from up to 5 devices at once
Must read