Skip to content
Prev 79669 / 398502 Next

Writing point pattern to a file

Ajit Chakrapani Warrier wrote:

            
You can get the coordinates of a point-pattern object with the $x and 
$y components. You can write to a file with R's 'write.table' function. 
So make the $x and $y components into a matrix, and use write.table. 
Here I'll use some write.table options to make a fairly clean file, 
coordinates separated by commas, with no row names, and nothing stuck in 
quote marks:

write.table(file="ppxy.csv",cbind(pp$x,pp$y),sep=",",row.names=FALSE,col.names=c('x','y'),quote=FALSE)

 > Also, it seems that the generated graph is different on each
 > invocation. Is there a way I could control this randomness, some seed
 > perhaps.

See the help for 'set.seed' - type 'help(set.seed)'

Baz