[R-sig-Geo] nndist {spatstat} distance unit output

Adrian Baddeley adrian.baddeley at uwa.edu.au
Tue Sep 24 03:03:10 CEST 2013


Just to clarify - 
    
   To set the **name** of the unit of length 
    in an object in the spatstat package,
    use  'unitname<-'
    For example
                  unitname(X) <- "km"
                  unitname(X) <- c("foot", "feet")
                  unitname(X) <- list("yard", "yards", 22)
    (The last example means that one unit is equal to 22 yards).

   To **convert the coordinates** from one unit to another, use 'rescale'
   For example if the coordinates in X are recorded in metres, then
                 X <- rescale(X, 1000)
    will convert the coordinates to kilometres (i.e. it will divide the coordinate values by 1000)
    and will also adjust the name of the unit of length accordingly. 
 
Adrian    

Prof Adrian Baddeley FAA
University of Western Australia  /and/ CSIRO Mathematics, Informatics & Statistics
Mail: <cet.uwa.edu.au>             Skype: adrian.baddeley
________________________________________
From: Rolf Turner [r.turner at auckland.ac.nz]
Sent: Tuesday, 24 September 2013 7:34 AM
To: Paolo Ramoni Perazzi
Cc: r-sig-geo at r-project.org; Adrian Baddeley
Subject: Re: [R-sig-Geo] nndist {spatstat} distance unit output

On 09/24/13 08:31, Paolo Ramoni Perazzi wrote:
> Hi everybody,
>
> A quite stupid question: does anybody know how to set the distance units
> (km, m, etc) when using nndist (spatstat library)?

The distance units are determined by the pattern "X" to which you are
applying
nndist.  You can change those units by applying the rescale() function to X.

E.g.

     X <- rescale(bei,1000)
     unitname(X) <- "kilometre"

     cheers,

     Rolf Turner

P. S.  It is the spatstat ***package*** not "library"!!!  (A library is
a *collection*
of packages.)  Repeat after me, 50 times: "spatstat ***package***, spatstat
***package***, ...."!!! :-)

     R. T.



More information about the R-sig-Geo mailing list