[英]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).我正在尝试使用 Kest 函数(以及 spatstat 包中的许多其他函数)。
i have made a ppp point pattern data set (ppp.1)我做了一个 ppp 点模式数据集(ppp.1)
summary (ppp.1) Planar point pattern: 189 points Average intensity 241122300 points per square unit摘要(ppp.1)平面点图案:189点平均强度241122300点每平方单位
Coordinates are given to 6 decimal places坐标精确到小数点后 6 位
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窗口:矩形 = [40.74603, 40.74662] x [-111.84693, -111.8456] 单位(0.000592 x 0.001324 单位)窗口面积 = 7.83834e-07 平方单位
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"当我尝试使用 Kest 函数:Kest(ppp.1) 时,出现以下错误: Kest(ppp.1) 中的错误:找不到函数“Kest”
in fact, there are many functions in the spatstat package that can't be found (eg, rpoint)... i get the same error.事实上,spatstat 包中有很多函数找不到(例如,rpoint)......我得到了同样的错误。
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这与我加载 spatstat 库时找不到“spatstat.random”有什么关系:错误:找不到“spatstat”所需的包“spatstat.random”
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)我正在使用最新版本的 R 和 spatstat(在英特尔 Mac 上):R 版本 4.2.1 (2022-06-23) -- "Funny-Looking Kid" 版权所有 (C) 2022 The R Foundation for Statistical Computing平台:x86_64-apple-darwin17.0(64位)
spatstat 2.3-4 downloaded installed directly from R.直接从 R 下载安装的 spatstat 2.3-4。
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
.前段时间,spatstat 是一个包含您提到的所有功能的大包,但由于 CRAN 的技术要求,它现在已被分成几个较小的包,所有这些包都根据
spatstat.xxxx
方案命名,例如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.包
spatstat
现在是一个几乎没有任何功能的伞包,但它依赖于spatstat.random
和其他包,当您在 R 控制台中执行library(spatstat)
时,它会加载所有这些包。
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
.在正常情况下,R 应该拒绝在没有所有需要的子包的情况下安装
spatstat
,但看起来你安装了没有例如 spatstat.random 的spatstat.random
。 Probably the easiest solution is to remove spatstat and install it again:可能最简单的解决方案是删除 spatstat 并重新安装:
remove.packages("spatstat")
install.packages("spatstat", dependencies = TRUE)
Alternatively you can try (requires a relatively new version of spatstat to already be installed):或者,您可以尝试(需要已经安装了相对较新版本的 spatstat):
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).要查找有关包的信息,您可以访问其 CRAN 页面(转到
cran.r-project.org
并查找 Contributed Packages)。
The CRAN page for spatstat says that spatstat 2.3-4
requires the packages spatstat.random
and spatstat.core
. spatstat 的CRAN 页面说
spatstat 2.3-4
需要包spatstat.random
和spatstat.core
。 This means that spatstat
depends on code that is provided in these other packages.这意味着
spatstat
依赖于这些其他包中提供的代码。
Your error message says that spatstat.random
is missing.您的错误消息说
spatstat.random
丢失。 This explains why the random generation function rpoint
was not found.这就解释了为什么没有找到随机生成函数
rpoint
。
As @EgeRubak says, the best solution is to remove and re-install spatstat
.正如@EgeRubak 所说,最好的解决方案是删除并重新安装
spatstat
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.