Here is the data I've made:
structure(list(Resort = c("Park City", "Powder Mountain", "Snowbird",
"Alta", "Snow Basin", "Deer Valley"), `Named Runs` = c(348, 154,
140, 116, 107, 103)), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))
Here is my code. I'm trying to get a bar graph, with resorts on the x-axis and named runs on the y-axis. Unfortunately, my graph is only showing resorts. How can I fix this? Thanks.
library(readxl)
Utah_ski_resort_data_ <- read_excel("Desktop/Utah ski resort data..xlsx")
View(Utah_ski_resort_data_)
table(Utah_ski_resort_data_$Resort)
table(Utah_ski_resort_data_$`Named Runs`)
barplot(table(Utah_ski_resort_data_$Resort)
barplot
with formula:
barplot(`Named Runs` ~ Resort, Utah_ski_resort_data_)
And this is a ggplot2
barplot:
library(ggplot2)
library(dplyr)
Utah_ski_resort_data_ %>%
ggplot(aes(x = Resort, y = `Named Runs`)) +
geom_bar(stat = "identity")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.