Data solutions with R
Your one-stop resource for all data analysis and visualization needs. Visit the society website: cscer.ca
Center for Social Capital and Environmental Research
01/01/2024
Show all summary statistics on one plot using the iris data:
Get the full code here:
iris %>% group_by(Species) %>% summarise_all(list(mean = ~mean(.), median = ~median(.), sd = ~sd(.))) %>% pivot_longer(-Species) %>% separate(name, into = c("variable", "stat"), sep = "_") %>% ggplot(aes(x = Species, y = value, fill = variable)) + geom_col(position = "dodge") + geom_text(aes(label = round(value, 2)), position = position_dodge(width = 0.9), size=3, vjust=2.3) + facet_wrap(vars(stat), scales = "free_y", ncol = 1) + theme(plot.margin = margin(30, 10, 10, 10, "pt")) + theme_minimal()+ theme_minimal() + theme(panel.background = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank())
12/30/2023
Today's cute plot in R studio:
Run this code in R compiler
https://www.mycompiler.io/new/r
matplot(iris[,1:4], type = "l", lty = 1, col = 1:4,
xlab = "Observation", ylab = "Value",
main = "Numeric Column Plots")
text(x =150, y = max(iris[,1]), labels = names(iris)[1], col = 1)
text(x = 150, y = max(iris[,2]), labels = names(iris)[2], col = 2)
text(x = 150, y = max(iris[,3]), labels = names(iris)[3], col = 3)
text(x = 150, y = max(iris[,4]), labels = names(iris)[4], col = 4)
Click here to claim your Sponsored Listing.
Category
Contact the school
Website
Address
451 Smyth Road
Ottawa, ON
K1H8M5