简体   繁体   中英

Searching for a way to use `linearKEuclid` and corresponding functions of `spatstat`

My goal is to analyse simple point patterns on linear networks with respect to Euclidean distance instead of shortest-path distance implemented in linearK and related functions of spatstat and its sub packages. Browsing through the web I found the promising named function linearKEuclid() and related functions here .

Unfortunately, I could not bring those functions to live on my Win machine, eg I run in errors like this

Error in xysegMcircle(Y$x, Y$y, D, df$x0, df$y0, df$x1, df$y1) : 
object 'C_circMseg' not found

or

Error in tapply(stuff$sinalpha, list(ii, jj), harmonicsum) :
object 'harmonicsum' not found

There is always something missing. For me, this means simply copying missing functions from the web, if available, does not help. Probably, a reason for this is that the functions are merely written for internal purposes and under internal development, see, for instance, here under "Details".

However, I am hoping for some recommendation making the fascinating code around linearKEuclid() runnable on my machine. Maybe, there are some chances that someone draws my attention to a downloadable developer version or something comparable. Many thanks in advance!

I understand your confusion and it is unnecessarily complicated to get this to work at the moment since problems with another package on CRAN prevents spatstat and subpackages to be updated at the moment. Indeed you need to install a development version of spatstat.linnet and its dependencies. This is most easily done if you have the package remotes installed (and necessary tools to compile packages from source which would be RTools on Windows):

First run (in sequence):

remotes::install_github("spatstat/spatstat.random")
remotes::install_github("spatstat/spatstat.sparse")
remotes::install_github("baddstats/spatstat.explore")
remotes::install_github("baddstats/spatstat.model")
remotes::install_github("spatstat/spatstat.linnet")

Now the function should work (you may have to restart R if an old version of spatstat.linnet was already loaded when you updated). Try eg the example from the help file:

library(spatstat.linnet)
X <- rpoislpp(5, simplenet)
K <- linearKEuclid(X)

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