An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130321/291272ec/attachment.pl>
spatstat error
4 messages · papao, Blaser Nello, Rolf Turner
Why do you first say min(Datos$x) and then give the numeric value of this minimum? Just delete all numerical values: danta=ppp(Datos$x, Datos$y, c(min(Datos$x), max(Datos$x)), c(min(Datos$y), max(Datos$y))) or if you really want to type the numeric constants (probably a bad idea) danta=ppp(Datos$x,Datos$y,c(1177842,1180213),c(1013581,1015575)) -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of papao Sent: Freitag, 22. M?rz 2013 00:20 To: R-help at r-project.org Subject: [R] spatstat error Good day Im working with some coordinates, and want to create a PPP object, I found that error:
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(D atos$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(m in(Datos$y)"1013581",max(Datos$y)"1015575")) Error: inesperado string constante en "danta=ppp(Datos$x,Datos$y,c(min(Datos$x)"1177842"" danta=ppp(Datos$x,Datos$y,window=owin(c(min(Datos$x)"1177842",max(Datos$x)"1 180213"),c(min(Datos$y)"1013581",max(Datos$y)"1015575"))) Error: inesperado string constante en "danta=ppp(Datos$x,Datos$y,window=owin(c(min(Datos$x)"1177842"" Thank you so much
Questions about spatstat should be directed to the R-Sig-Geo list, or better still, to the package maintainers. To add a bit to what Blaser Nello has already told you: (1) Your syntax in respect of the use of the min() function is indeed incomprehensibly bizarre. (2) Blaser Nello has indicated useful *correct* alternatives. Another possibility is to use the ripras() function from spatstat, e.g. Dantos <- with(Datos,ppp(x,y,window=ripras(x,y,shape="rectangle"))) (3) If you are actually going to do any statistical analysis of the point pattern then it is a VERY BAD idea to "estimate" the observation window from the data. The observation window should be *known* a priori, else the statistical results can be wrong or misleading. To quote from Adrian Baddeley's notes:
It is important to know the window W, since we need to know where points were not observed. Even something as simple as estimating the density of points depends on the window. It would be wrong, or at least different, to analyze a point pattern dataset by ?guessing? the appropriate window. An analogy may be drawn with the difference between sequential experiments and experiments in which the sample size is fixed a priori.
See:
@techreport{Baddeley2010,
author = {Adrian Baddeley},
title = {Analysing spatial point patterns in \textsf{R},
\textbf{Version 4.1}},
institution = {CSIRO},
year = {2010},
month = {December},
note = {URL:
\url{http://www.csiro.au/resources/Spatial-Point-Patterns-in-R}},
type = {Workshop Notes}
}
cheers, Rolf Turner
On 03/22/2013 12:19 PM, papao wrote:
Good day Im working with some coordinates, and want to create a PPP object, I found that error:
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(D atos$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(m in(Datos$y)"1013581",max(Datos$y)"1015575")) Error: inesperado string constante en "danta=ppp(Datos$x,Datos$y,c(min(Datos$x)"1177842"" danta=ppp(Datos$x,Datos$y,window=owin(c(min(Datos$x)"1177842",max(Datos$x)"1 180213"),c(min(Datos$y)"1013581",max(Datos$y)"1015575"))) Error: inesperado string constante en "danta=ppp(Datos$x,Datos$y,window=owin(c(min(Datos$x)"1177842""
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130323/c140f1d6/attachment.pl>