简体   繁体   中英

missing functions in spatstat library (such as Kest, and rpoint)

i'm trying to use the Kest function (and many other in the spatstat package).

i have made a ppp point pattern data set (ppp.1)

summary (ppp.1) Planar point pattern: 189 points Average intensity 241122300 points per square unit

Coordinates are given to 6 decimal places

Window: rectangle = [40.74603, 40.74662] x [-111.84693, -111.8456] units (0.000592 x 0.001324 units) Window area = 7.83834e-07 square units

when i try to use the Kest function: Kest(ppp.1), i get the following error: Error in Kest(ppp.1) : could not find function "Kest"

in fact, there are many functions in the spatstat package that can't be found (eg, rpoint)... i get the same error.

does this have anything to do with "spatstat.random" not being found when i load the spatstat library: Error: package 'spatstat.random' required by 'spatstat' could not be found

i'm using the most current version of R and spatstat (on an intel Mac): R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid" Copyright (C) 2022 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin17.0 (64-bit)

spatstat 2.3-4 downloaded installed directly from R.

thank you.

Some time ago spatstat was one big package containing all the functions you mention, but due to technical requirements from CRAN it has now been split into several smaller packages all named according to the scheme spatstat.xxxx such as spatstat.random . The package spatstat is now an umbrella package with barely any functions, but it depends on spatstat.random and others, and it loads all these packages when you execute library(spatstat) in the R console.

Under normal circumstances R should refuse to install spatstat without all the needed sub-packages, but it appears you have an installation of spatstat without eg spatstat.random . Probably the easiest solution is to remove spatstat and install it again:

remove.packages("spatstat")
install.packages("spatstat", dependencies = TRUE)

Alternatively you can try (requires a relatively new version of spatstat to already be installed):

pkgs <- spatstat::spatstat.family()
install.packages(pkgs)

To find information about a package, you can visit its CRAN page (go to cran.r-project.org and look for Contributed Packages).

The CRAN page for spatstat says that spatstat 2.3-4 requires the packages spatstat.random and spatstat.core . This means that spatstat depends on code that is provided in these other packages.

Your error message says that spatstat.random is missing. This explains why the random generation function rpoint was not found.

As @EgeRubak says, the best solution is to remove and re-install spatstat .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM