I have a data frame with 79 columns.
For each column, I am trying to produce an entirely separated boxplot.
I have tried apply(integers, 2,function(x) boxplot(x, main = colnames(integers["x"])))
However, I cannot add the title of each column to the respective boxplot.
library(tidyverse)
plot_function <- function(column_name, data_in) {
plot_out <- ggplot(data_in, aes_string(y = column_name)) +
geom_boxplot() +
labs(title = column_name)
return(plot_out)
}
plot_columns <- names(iris)[1:4]
plot <- lapply(plot_columns, function(x, y) plot_function(x, y), y = iris)
plot[[1]]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.