how do you solve this error

if (!require("rspatial")) devtools::install_github('rspatial/rspatial')

library(rspatial)
d <- sp_data('precipitation')
head(d)

there is no package called ‘rspatial’

My guess is that you do not have the devtools package installed. There definitely is an rspatial package on Github, and you can install it using the install_github function.

Try running this (it works for me), and let me know how that goes:

install.packages("devtools")
devtools::install_github("rspatial/rspatial")

library(rspatial)
d <- sp_data('precipitation')
head(d)
1 Like

Tried a couple of methods to install devtools but with no sucess devtools
this has been with no sucess only to run into errors .

devtools::install_github("hadley/devtools")

method2:
this too dint work for me

library(devtools)
build_github_devtools()

#### Restart R before continuing ####
install.packages("devtools.zip", repos = NULL)

# Remove the package after installation
unlink("devtools.zip")

method3 the least which i had not tried just installed devtools but could not install the rspatial library from github ripo still experiencing some issues .

install.packages("devtools")
devtools::install_github("rspatial/rspatial")

library(rspatial)
d <- sp_data('precipitation')
head(d)
1 Like

whats the best way to upgrade since i cant find a recent article on updating the r vesrion

install.packages("installr")

library(installr)

updateR()

Simplest way is to browse to your nearest CRAN mirror site, download the installer, and run it. The registry is automatically modified so that RStudio knows to use the most recent installed version.

hello,
just installed the latest version


R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

then installed devtools package

install.packages("devtools")
#this wa sucessfuly installed

then tried to install rspatial and threw the errors

if (!require("rspatial")) devtools::install_github('rspatial/rspatial')
Loading required package: rspatial
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools custom from https://cran.r-project.org/bin/windows/Rtools/.
Error: Failed to install 'unknown package' from GitHub:
  Timeout was reached: [api.github.com] Resolving timed out after 10000 milliseconds
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘rspatial’

then went ahead to try and install the missing package but still failed to install

install.packages("Rtools")
Installing package into ‘C:/Users/ShellHunter.DESKTOP-EO423F6/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘Rtools’ is not available (for R version 4.0.2)

then tried a different way of installing rspatial but still failed

install.packages("rspatial")
Installing package into ‘C:/Users/ShellHunter.DESKTOP-EO423F6/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘rspatial’ is not available (for R version 4.0.2)
#i have solved the issue thanks all for your assistance
1 Like

Rtools is not itself a package, rather its a utility (binary) you download it from here
https://cran.r-project.org/bin/windows/Rtools/

#could this be the reason am facing alot of issues

Hi @devmartin,
We need more feedback from your system as to why the following code fails. It works for me fine under Windows 10 using R-4.0.2. Please run it and then post the full copy-pasted output.

sessionInfo()
install.packages("devtools")
library(devtools)
devtools::install_github("rspatial/rspatial")

library(rspatial)
d <- sp_data('precipitation')
head(d)

HTH

Hi @devmartin,
You are using quite an old version of R (R-3.6.1; this is separate to the version of RStudio). I suggest you upgrade to the latest version of R (R-4.0.2). Then run the code I posted earlier (don't forget to include the line: library(devtools)). For each new R session you have to load the package into memory from the library where it was installed by using the library() function.

BTW, its much better to post copy-pasted code or output rather than screen-shots.

HTH