在 R 中将多边形转换为 sf
Converting polygon to sf in R
使用此处的教程:https://www.r-spatial.org/r/2018/10/25/ggplot2-sf-2.html(在“状态(多边形数据)”部分),我正在尝试将多边形转换为 sf 对象。
library("maps")
states <- st_as_sf(map("state", plot = FALSE, fill = TRUE))
head(states)
我收到错误消息:Error in as_mapper(.f, ...) : argument ".f" is missing, with no default
提前致谢!
看起来它混淆了 purrr
包中的 map()
和 maps
包中的 map()
。尝试:
states <- st_as_sf(maps::map("state", plot = FALSE, fill = TRUE))
使用此处的教程:https://www.r-spatial.org/r/2018/10/25/ggplot2-sf-2.html(在“状态(多边形数据)”部分),我正在尝试将多边形转换为 sf 对象。
library("maps")
states <- st_as_sf(map("state", plot = FALSE, fill = TRUE))
head(states)
我收到错误消息:Error in as_mapper(.f, ...) : argument ".f" is missing, with no default
提前致谢!
看起来它混淆了 purrr
包中的 map()
和 maps
包中的 map()
。尝试:
states <- st_as_sf(maps::map("state", plot = FALSE, fill = TRUE))