How to use data frame row indices as x-values in a ggplot2 plot in the R programming language. More details: statisticsglob...
R code of this video:
data <- data.frame(y = c(1, 5, 4, 6, 5, 7)) # Create example data frame
data # Print example data frame
install.packages("ggplot2") # Install & load ggplot2 package
library("ggplot2")
ggplot(data, # Draw ggplot2 barplot
aes(x = 1:nrow(data),
y = y)) +
geom_col()
Follow me on Social Media:
Facebook - Statistics Globe Page: / statisticsglobecom
Facebook - R Programming Group for Discussions & Questions: / statisticsglobe
Facebook - Python Programming Group for Discussions & Questions: / statisticsglobepython
LinkedIn - Statistics Globe Page: / statisticsglobe
LinkedIn - R Programming Group for Discussions & Questions: / 12555223
LinkedIn - Python Programming Group for Discussions & Questions: / 12673534
Twitter: / joachimschork
Music by bensound.com
13 окт 2024