Starting this week, I will incorporate more content that has to do with R into this SubStack page.
According to R-Project.org, R is a language and environment for statistical computing and graphics.
Today, I would like to show you how to use R to create multiple plots at once.
my_data <- data.frame(x=rnorm(100), y=rnorm(100), z=rnorm(100))
for (col_name in names(my_data)) {
hist(my_data[[col_name]], main=col_name)
}
In the code chunk above, I have defined a data frame that’s made up of three columns, x, y, and z, each consisting of 100 sample values from a normal distribution. The for loop plots the distribution of numerical values contained in each of the columns.
Feedback
The Substackers’ message board is a place where you can share your coding journey with me, so that we can exchange ideas and become better together.
Please open the message board and share with me your thoughts!