gpt4 book ai didi

r - 错误:isTRUE(gpclibPermitStatus())不是TRUE

转载 作者:行者123 更新时间:2023-12-03 09:46:26 24 4
gpt4 key购买 nike

这个问题可能是an earlier unanswered one的副本。我仍然有问题。

我正在尝试使用邮政编码shapefile并出现以下错误:

tract <- readOGR(dsn = ".", layer = "cb_2013_us_zcta510_500k")
tract<-fortify(tract, region="GEOID10")
Error: isTRUE(gpclibPermitStatus()) is not TRUE

我尝试安装gpclib来解决此问题,但随后出现以下错误:
install.packages("gpclib")

Installing package into ‘C:/Users/Nick/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘gpclib’
These will not be installed

救命?

最佳答案

您可以查看ggplot2 / R / fortify-spatial.r的Hadley的master文件。根据this外部链接,我的理解是第31–34行(当前形式)用于读取类似

# Union together all polygons that make up a region
try_require(c("gpclib", "maptools"))
unioned <- unionSpatialPolygons(cp, invert(polys))

因此,当时解决问题的一种方法是打开许可证
library(rgdal)
library(maptools)
if (!require(gpclib)) install.packages("gpclib", type="source")
gpclibPermit()

就像@ rcs,@ Edzer Pebesma和此 answer一样, rgeos应该可以解决最新安装的问题。

关于r - 错误:isTRUE(gpclibPermitStatus())不是TRUE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30790036/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com