filmov
tv
Draw Multiple Boxplots in One Graph in R Side-by-Side (4 Examples) | Base, ggplot2 & lattice Package
Показать описание
R code of this video:
B = runif(1000),
C = rpois(1000, 3))
boxplot(data) # Applying boxplot function
library("reshape2") # Load reshape2
data_long <- melt(data) # Reshaping data frame
library("ggplot2") # Load ggplot2
ggplot(data_long, aes(x = variable, y = value)) + # Applying ggplot function
geom_boxplot()
library("lattice") # Load lattice package
bwplot(value ~ variable, data_long) # Applying bwplot function
data(iris) # Loading iris flower data set
iris_long <- melt(iris, id = "Species") # Reshaping iris data
library("ggplot2") # Load ggplot2
ggplot(iris_long, aes(x = variable, y = value, color = Species)) + # Applying ggplot function
geom_boxplot()
Follow me on Social Media:
B = runif(1000),
C = rpois(1000, 3))
boxplot(data) # Applying boxplot function
library("reshape2") # Load reshape2
data_long <- melt(data) # Reshaping data frame
library("ggplot2") # Load ggplot2
ggplot(data_long, aes(x = variable, y = value)) + # Applying ggplot function
geom_boxplot()
library("lattice") # Load lattice package
bwplot(value ~ variable, data_long) # Applying bwplot function
data(iris) # Loading iris flower data set
iris_long <- melt(iris, id = "Species") # Reshaping iris data
library("ggplot2") # Load ggplot2
ggplot(iris_long, aes(x = variable, y = value, color = Species)) + # Applying ggplot function
geom_boxplot()
Follow me on Social Media:
Комментарии