[R-sig-Geo] Create/convert a point pattern from raw txt file in spatstat?

opheliawang at mail.utexas.edu opheliawang at mail.utexas.edu
Tue Oct 14 19:25:03 CEST 2008


Hi all,

I'm new to R, so I'm still learning how to do this: I have a txt file  
that contains X Y coordinate of trees (range from 0-100 for both X and  
Y) and a "mark" column that's the tree ID. The total is about 600  
lines. Part of the data looks like:

X	Y	Mark
1	94	1
2.5	94.5	4
3	93	5
4	92	6
4	95	7
6	98	8
4	84	9
6	86	10
6	86	11
6	86	12
6	86	13
8	88	14
9.5	89.5	15
10	90	16

In order to create a point pattern, should I used scanpp, ppp, or  
as.ppp?Here's the error I get for each command:

> test <- read.table("C:/dissertation/data2006/Parcela_1-3/Juyuin_tree.txt")
> w <- owin(c(0,100),c(0,100))
> as.ppp(test, w, fatal=TRUE)
Error: is.numeric(x) is not TRUE

> ppp(x,y, xrange=c(0,100), yrange=c(0,100),marks, check=TRUE)
Error in ppp(x, y, xrange = c(0, 100), yrange = c(0, 100), marks,  
check = TRUE) : object "x" not found

> scanpp("C:/dissertation/data2006/Parcela_1-3/Juyuin_tree.txt",  
> c(0,100,0, 100), header=TRUE, dir="", multitype=FALSE)
Error in verifyclass(window, "owin") : argument ?window? is not of  
class ?owin?

> scanpp("C:/dissertation/data2006/Parcela_1-3/Juyuin_tree.txt", w,  
> header=TRUE, dir="", multitype=FALSE)
Error: is.numeric(x) is not TRUE

My problems are not knowing which command to use and how the "window"  
should be specified. Can anyone help me with this? Thanks so much!

Ophelia




More information about the R-sig-Geo mailing list