On Fri, 2011-01-07 at 12:17 -0800, paogeomat wrote:
> I want to analize some points location using the ppp, but i have this
> problem:
> 
> Datos=read.table("puntos_texto.txt",dec=".",sep="\t",header=T)
> > summary(Datos)
>        id               y                 x          
>  Min.   :   1.0   Min.   :1013581   Min.   :1177842  
>  1st Qu.: 821.2   1st Qu.:1014442   1st Qu.:1179658  
>  Median :1641.5   Median :1014455   Median :1179670  
>  Mean   :1641.8   Mean   :1014465   Mean   :1179652  
>  3rd Qu.:2462.8   3rd Qu.:1014473   3rd Qu.:1179680  
>  Max.   :3283.0   Max.   :1015575   Max.   :1180213  
> > danta=ppp(Datos$x,Datos$y,c(min(Datos$x)1177842,max(Datos$x)1180213),c(min(Datos$y)1013581,max(Datos$y)1015575))
> Error: inesperado constante numérica en
> "danta=ppp(Datos$x,Datos$y,c(min(Datos$x)1177842"
> > danta=ppp(Datos$x,Datos$y,c(min(Datos$x)"1177842",max(Datos$x)"1180213"),c(min(Datos$y)"1013581",max(Datos$y)"1015575"))
> Error: inesperado string constante en
> "danta=ppp(Datos$x,Datos$y,c(min(Datos$x)"1177842""
> 

Space you code out! The it is easy to spot what is wrong:

danta = ppp(Datos$x, Datos$y, c(min(Datos$x)1177842, max(Datos
$x)1180213), c(min(Datos$y)1013581, max(Datos$y)1015575))

You have lots of the following:

c(min(Datos$y)1013581, max(Datos$y)1015575)
             ^^^                  ^^^

you can't do this! Why are you including the numbers here? These are the
min and max values, so either use c(1177842, 1180213), or c(min(x),
max(x)), or range(x), but not a combination of the numbers and the
function output. Wouldn't this:

c(min(Datos$y), max(Datos$y))

or even

range(Datos$y)

be better?

Also, if we drop the syntax errors for the numbers you keep typing in,
you could write this more cleanly by using `with()`:

danta <- with(Datos, ppp(x, y, c(min(x), max(x)), c(min(y), max(y))))

or using range

danta <- with(Datos, ppp(x, y, range(x), range(y)))

Those two are far easier to read than your code.

HTH

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to