RPubs will retire in June 2027. Your existing documents will stay accessible through December 31, 2031
and Connect Cloud is the recommended home for new publishing. Read the blog post

Recently Published

Histogram
library(ggplot2) histogram <- ggplot(diamonds, aes(x = price)) + geom_histogram(binwidth = 500, fill = "blue", color = "black") + labs(title = "Histogram: Distribution of Diamond Prices", x = "Price", y = "Frequency") + theme_minimal() print(histogram)
Bar Plot
library(ggplot2) data("diamonds") bar_chart <- ggplot(diamonds, aes(x = cut, fill = cut)) + geom_bar() + labs(title = "Bar Chart: Count of Diamonds by Cut", x = "Cut", y = "Count") + theme_minimal() print(bar_chart)
Document
Scatter plot for Fruit Sales
library(ggplot2) ggplot(fruit_data, aes(x = Fruit, y = Sales)) + geom_point(size = 4, color = "red") + labs(title = "Fruit Sales (Scatter Plot)", x = "Fruit", y = "Sales Count")
Document
Student Survey Data Frame
Publish Document
Radar 3
data <- data.frame( Communication = c(5, 4, 3, 2, 1), Teamwork = c(4, 5, 2, 3, 1), ProblemSolving = c(3, 4, 5, 2, 1), Creativity = c(2, 3, 4, 5, 1) ) data <- rbind(rep(5, 4), rep(0, 4), data) radarchart(data, title = "Radar Chart: Employee Performance", pcol = "purple", pfcol = rgb(0.5, 0, 0.5, 0.3), plwd = 2)
Radar 2
data <- data.frame( Product1 = c(5, 4, 3, 2, 1), Product2 = c(4, 5, 2, 3, 1), Product3 = c(3, 4, 5, 2, 1) ) data <- rbind(rep(5, 3), rep(0, 3), data) radarchart(data, title = "Radar Chart: Comparing Products", pcol = c("blue", "red", "green"), pfcol = c(rgb(0, 0, 1, 0.3), rgb(1, 0, 0, 0.3), rgb(0, 1, 0, 0.3)), plwd = 2)
Radar Chart 1
install.packages("fmsb") library(fmsb) data <- data.frame( Speed = c(5, 4, 3, 2, 1), Durability = c(4, 5, 2, 3, 1), Reliability = c(3, 4, 5, 2, 1), Efficiency = c(2, 3, 4, 5, 1) ) data <- rbind(rep(5, 4), rep(0, 4), data) radarchart(data, title = "Radar Chart: Product Attributes", pcol = "blue", pfcol = rgb(0, 0, 1, 0.3), plwd = 2)
Map (US)
us_map <- map_data("state") ggplot(us_map, aes(x = long, y = lat, group = group)) + geom_polygon(fill = "lightgreen", color = "black") + theme_minimal() + ggtitle("US State Map Example")
Document
Maps
install.packages("maps") install.packages("ggplot2") library(maps) library(ggplot2) world_map <- map_data("world") ggplot(world_map, aes(x = long, y = lat, group = group)) + geom_polygon(fill = "lightblue", color = "black") + theme_minimal() + ggtitle("World Map Example")