My goal is to analyse simple point patterns on linear networks with respect to Euclidean instead of shortest-path distance. For the latter distance metric, my analysis relies on linearK()
and related functions in {spatstat}
. For the former, I found the promising named function linearKEuclid()
and further functions here.
Unfortunately, I could not bring those functions to life on my Win machine. Errors like those occur:
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. Probably, a reason for this is that the functions are merely written for internal purposes and under development, see, for instance, here (cp. "Details").
However, I am hoping for some recommendation making the code around linearKEuclid()
runnable on my machine. Maybe, someone draws my attention to a downloadable developer version or something comparable.
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 e.g. the example from the help file:
library(spatstat.linnet)
X <- rpoislpp(5, simplenet)
K <- linearKEuclid(X)