R包 ggvoroni(已弃用)需要rgeos(已弃用)
我正在使用R 版本4.6.0,想安装已被弃用的包 ggvoroni,它依赖于同样已被弃用的包 rgeos。
当我运行
remotes::install_version("rgeos", version = "0.6-4", repos = "http://cran.r-project.org")
时,出现错误
* installing *source* package 'rgeos' ...
** this is package 'rgeos' version '0.6-4'
** package 'rgeos' successfully unpacked and MD5 sums checked
** using staged installation
**********************************************
WARNING: this package has a configure script
It probably needs manual configuration
**********************************************
** libs
using C compiler: 'gcc.exe (GCC) 14.3.0'
using C++ compiler: 'G__~1.EXE (GCC) 14.3.0'
rm -f rgeos.dll dummy.o init.o local_stubs.o rgeos.o rgeos_R2geos.o rgeos_R2geosMP.o rgeos_bbox.o rgeos_buffer.o rgeos_coord.o rgeos_geos2R.o rgeos_linearref.o rgeos_misc.o rgeos_poly2nb.o rgeos_predicate_binary.o rgeos_predicate_unary.o rgeos_topology.o rgeos_topology_binary.o rgeos_validate.o rgeos_wkt.o
g++ -std=gnu++20 -I"C:/PROGRA~1/R/R-46~1.0/include" -DNDEBUG -I'C:/Users/.../AppData/Local/R/win-library/4.6/sp/include' -I"C:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c dummy.cc -o dummy.o
gcc -I"C:/PROGRA~1/R/R-46~1.0/include" -DNDEBUG -I'C:/Users/.../AppData/Local/R/win-library/4.6/sp/include' -I"C:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -std=gnu2x -mfpmath=sse -msse2 -mstackrealign -c init.c -o init.o
In file included from init.c:3:
rgeos.h:59:10: fatal error: sp.h: No such file or directory
59 | #include "sp.h"
| ^~~~~~
compilation terminated.
make: *** [C:/PROGRA~1/R/R-46~1.0/etc/x64/Makeconf:297: init.o] Error 1
ERROR: compilation failed for package 'rgeos'
* removing 'C:/Users/.../AppData/Local/R/win-library/4.6/rgeos'
...
我应该如何解决这个问题?
解决方案
请从 https://github.com/garretrc/ggvoronoi 安装,你的 rgeos 问题应该就会消失。
在2024年 1月 2日,rgeos 已从其导入/依赖项中移除,相关提交为 [6d98c7b] 和 [cce6593]:
已通过其 DESCRIPTION 文件确认(此处为片段):
Package: ggvoronoi
Version: 0.8.6
Date: 2024-01-02
Title: Voronoi Diagrams and Heatmaps with 'ggplot2'
Depends: R (>= 2.10), ggplot2 (>= 2.2.0)
Imports: deldir, sp, raster, terra, methods
Suggests: knitr, rmarkdown, ggmap, dplyr, scales,
testthat, vdiffr, mapproj
(在这些包中,我没有看到对 rgeos 的引用。)
请使用remotes安装它:
remotes::install_github("garretrc/ggvoronoi")
# Downloading GitHub repo garretrc/ggvoronoi@HEAD
# Installing package into ‘/Users/r2/Library/R/4.5’
# (as ‘lib’ is unspecified)
# ── R CMD build ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
# * checking for file ‘/private/var/folders/3f/0hlmq7rx34ddjqtlc1lqbxl80000gn/T/RtmpLqoDQV/remotes185d521ef312/garretrc-ggvoronoi-6d98c7b/DESCRIPTION’ ... OK
# * preparing ‘ggvoronoi’:
# * checking DESCRIPTION meta-information ... OK
# * checking for LF line-endings in source and make files and shell scripts
# * checking for empty or unneeded directories
# * building ‘ggvoronoi_0.8.6.tar.gz’
# Installing package into ‘/Users/r2/Library/R/4.5’
# (as ‘lib’ is unspecified)
# * installing *source* package ‘ggvoronoi’ ...
# ** this is package ‘ggvoronoi’ version ‘0.8.6’
# ** using staged installation
# ** R
# ** data
# *** moving datasets to lazyload DB
# ** byte-compile and prepare package for lazy loading
# ** help
# *** installing help indices
# ** building package indices
# ** installing vignettes
# ** testing if installed package can be loaded from temporary location
# ** testing if installed package can be loaded from final location
# ** testing if installed package keeps a record of temporary installation path
# * DONE (ggvoronoi)
站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。
