【发布时间】:2022-11-03 00:33:30
【问题描述】:
我使用以下代码将我的数据上传到 R
if (!file.exists("ames-liquor.rds")) {
url <- "https://github.com/ds202-at-ISU/materials/blob/master/03_tidyverse/data/ames-liquor.rds?raw=TRUE"
download.file(url, "ames-liquor.rds", mode="wb")
}
data <- readRDS("ames-liquor.rds")
然后使用此代码提取地理纬度和经度
ata <- data %>%
separate(remove= FALSE,
col = 'Store Location' , sep=" ",
into=c("toss-it", "Latitude", "Longitude"))
data <- data %>% mutate(
Latitude = parse_number(Latitude),
Longitude = parse_number(Longitude)
)
现在我需要
Plot a scatterplot of lat and long of store locations.
- Provide a visual breakdown of the liquor category (by `Category Name`). Include volume sold in the breakdown. Make sure that all labels are readable
对于它的第一部分,我做了这个
data %>%
ggplot(aes(x = Latitude, y = Longitude))+
geom_point(na.rm = TRUE)
但我似乎无法找到如何
- Provide a visual breakdown of the liquor category (by `Category Name`). Include volume sold in the breakdown. Make sure that all labels are readable.
我将衷心感谢您的帮助
【问题讨论】:
-
在
ggplot调用的aes()部分中添加color = `Category Name`。
标签: r statistics r-markdown