1

I have downloaded and installed the 'spatstat' package multiple times, including by downloading the files. But every time I try to run it i get this error

Failed with error:  ‘package ‘spatstat.data’ required by ‘spatstat’ could not be found’`

I've installed spatstat.data separately and updated to R 4.2.1 but that didn't help, and now I've run out of ideas

  • 2
    It is not really possible to diagnose the problem with so little information. Show the code you used to install `spatstat` on your machine. You may also want to include the output from `R.version`. The package `spatstat.data` should automatically be installed with `install.packages("spatstat")` and loaded with `library(spatstat)`. – dcarlson Oct 24 '22 at 02:34
  • It would be helpful with output from `install.packages(spatstat.data)` and from the following (two line command): `inst <- installed.packages();inst[grep("spatstat", rownames(inst)), 2:3]` – Ege Rubak Oct 24 '22 at 05:45

1 Answers1

3

This may be a temporary problem due to spatstat.data and spatstat.utils recently being updated at the CRAN repository hosting R packages. When new versions arrive at CRAN they are in "source" form with code that needs to be compiled to run on the computer. CRAN compiles these packages for Windows and OSX, but it takes a couple of days before they are available in the compiled (binary) version. It requires additional tools on your computer to be able to compile packages yourself and apparently you don't have the tools. No need to install the tools if you are able to wait a day or two for CRAN to make the binary versions available.

Alternatively you may install the compiled packages through the service r-universe.dev immediately:

install.packages(c("spatstat.utils", "spatstat.data"), 
                 repos = "https://spatstat.r-universe.dev")
Ege Rubak
  • 4,347
  • 1
  • 10
  • 18