1

I was wondering if the marks command inside the spatstat package could be used with categorical variables instead of continous ones. I have an xlsx table (A2N) with three columns: Size (categoric), CoordX(numeric) and CoordY(numeric).

Here is the script I´m using:

attach(A2N)
MPN2 <- ppp(CoordX, CoordY, c(621470,623141), c(9412006,9414455))
plot(MPN2)
marks(MPN2) <- A2N[, c("Size")]
plot(Smooth(MPN2))

And this is the message that comes up:

> plot(Smooth(MPN2))
Error in r[i1] - r[-length(r):-(length(r) - lag + 1L)] : 
  non-numeric argument to binary operator
In addition: Warning messages:
1: some mark values are NA in the point pattern X 
2: some mark values are NA in the point pattern X 
3: some mark values are NA in the point pattern X 
MrFlick
  • 195,160
  • 17
  • 277
  • 295
epmc
  • 11
  • 1
  • You need to be more specific about what your data contains. In what sense are your sizes categorical (factor in R with which levels)? And what do you expect to get out of calling `Smooth` with categorical marks? It seems that you have `NA` values in your marks which `spatstat` probably doesn't like too much. Please elaborate on you question and make the code reproducible for us (make fake data or use built-in if you can't share). – Ege Rubak Jul 08 '17 at 21:23
  • This error message does not come from the `spatstat` package. After the error occurs, please type `traceback()` which will trace the execution which led to the error; and post the output here. – Adrian Baddeley Jul 09 '17 at 12:54

0 Answers0