[R] SpatStat Kest - Error Message help

Martin Maechler maechler at stat.math.ethz.ch
Tue Sep 6 10:33:46 CEST 2005

>>>>> "AB" == Adrian Baddeley <adrian at maths.uwa.edu.au>
>>>>>     on Mon, 5 Sep 2005 10:10:31 +0800 writes:

    AB> On Thu, 1 Sep 2005, DrakeGis wrote:
    >> Hi I'm working with the function Kest in the package SpatStat (under LINUX
    >> with R 2.1.0). In order to evaluate the statistical significance of my
    >> point pattern I'm doing 999 Montecarlo replications. The script that use
    >> the Kest function runs OK for most of the different point patterns that I
    >> have but for a particular point pattern, which have only 17 points, it
    >> runs until the 34th iteration and then I receive this message:
    >> Error in "[<-"(`*tmp*`, index, value = NULL) :
    >> incompatible types (1000) in subassignment type fix
    >> Execution halted
    >> Do you have any idea about what could be the cause of this ? Thanks in
    >> advance.

    AB> This is not an error message from 'spatstat' itself.

    AB> The message has been generated by the function "[<-" 
    AB> which is called when you assign values to a subset of a dataset 
    AB> (in a command like x[z] <- v). The message appears to say that the
    AB> replacement value v is not of the same type as the original vector x. 
And please get into the habit of saying


after such an error.
This would have quickly revealed if the error came from R function
called from a function from 'spatstat' or not.

Also, maybe more people should learn about `basic debugging', 
by using something like

   options(error = recover)
   options(error = dump.frames) ## needs a later call to debugger()

before running the script that produces the error.
The end of the examples  ?options  show an example to use when
running an R script.
    AB> You say that you are running a "script that uses the Kest function".
    AB> The error is probably inside that script. If you send the script to us
    AB> we can probably spot the problem for you.

    AB> As Rolf mentioned in his email, spatstat provides a
    AB> command "envelope" to compute simulation envelopes. This
    AB> might be sufficient for your needs.

    AB> regards
    AB> Adrian Baddeley

Martin Maechler

More information about the R-help mailing list