在R中将多边形转换为SF [英] Converting polygon to sf in R

查看:69
本文介绍了在R中将多边形转换为SF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此处使用教程: https://www.r-spatial.org/r/2018/10/25/ggplot2-sf-2.html (在状态(多边形数据)"部分)中,我试图将多边形转换为sf对象.

Using the tutorial here: https://www.r-spatial.org/r/2018/10/25/ggplot2-sf-2.html (in the section called "States (polygon data)"), I'm trying to convert polygons to an sf object.

library("maps")

states <- st_as_sf(map("state", plot = FALSE, fill = TRUE))
head(states)

我收到错误消息: as_mapper(.f,...)中的错误:参数".f"缺少,没有默认值

提前谢谢!

推荐答案

似乎使 purrr 包中的 map() map()<来自 maps 包.试试:

Looks like it's confusing map() from the purrr package with map() from the maps package. Try:

states <- st_as_sf(maps::map("state", plot = FALSE, fill = TRUE))

这篇关于在R中将多边形转换为SF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆