I have obtained some error trying to install maptools in Rstudio

4.6k views Asked by At

Hello to everyone I would like to know how to install the package called "maptools" in R. I was trying to do it by hand, downloading from "https://cran.r-project.org/src/contrib/Archive/maptools/". But I can´t. After attempting the installation, the following error message appears.

"https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/HP/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)
* installing *source* package 'maptools' ...
** package 'maptools' successfully unpacked and MD5 sums checked
** using staged installation
** libs
Error in system(paste(MAKE, p1(paste("-f", shQuote(makefiles))), "compilers"),  : 
  'make' not found
* removing 'C:/Users/HP/AppData/Local/R/win-library/4.3/maptools'
Warning in install.packages :
  installation of package ‘E:/R_para_politicas_publicas/Clase_6/4_Econometria Espacial/Packages/maptools_1.1-8.tar.gz’ had non-zero exit status"

I would like to know either if someone can solve that installation problem or it's a problem with R, Rstudio or my windows 11 86*64.

1

There are 1 answers

1
margusl On

{maptools} is retired and binary is removed from CRAN, to build it from source you'd first need Rtools(43). Though you could also install binaries from Posit Public Package Manager snapshots. As {maptools} was archived on 2023-10-16, snapshot from 2023-10-13 should do:

install.packages("maptools", repos = "https://packagemanager.posit.co/cran/2023-10-13")

If it's some legacy project you are working on, I'd consider setting up a renv environment with specific repos for this to keep those packages in project's package library and to avoid version conflicts:

> renv::init(repos = "https://packagemanager.posit.co/cran/2023-10-13")
> install.packages("maptools")
# Downloading packages -------------------------------------------------------
- Downloading maptools from CRAN ...            OK [1.8 Mb in 2.4s]
Successfully downloaded 1 package in 7.8 seconds.

The following package(s) will be installed:
- maptools [1.1-8]
- sp       [2.1-0]
...
Do you want to proceed? [Y/n]: 
# Installing packages --------------------------------------------------------
- Installing sp ...                             OK [linked from cache]
- Installing maptools ...                       OK [installed binary and cached in 0.58s]
Successfully installed 2 packages in 0.67 seconds.