[R-sig-Geo] Help with ENFA in R

JonathanAronson jagaronson at gmail.com
Wed Apr 10 12:02:03 CEST 2013

Hi Clement

Thank you very much for your input. I have read the maptools information and
seen the examples for readAsciiGrid. I would like to create a
SpatailPixelDataFrame which contains the raster maps of 15 environmental
variables. Therefore, similar to the lynxjura$map SpatailPixelDataFramewhich
contains 4 environmental variables. How did you create the lynxjura$map data
frame - can you please show me step by step? You suggested using the
readAsciiGrid function to import my maps. Is this how I can create the
SpatailPixelDataFrame with the 15 variables I need? I do not understand the
example code to do this (I am new to R): 

x <- readAsciiGrid(system.file("grids/test.ag", package="maptools")[1])
xp <- as(x, "SpatialPixelsDataFrame")
abline(h=332000, lwd=3)
xpS <- xp[coordinates(xp)[,2] < 332000,]
xS <- as(xpS, "SpatialGridDataFrame")
tmpfl <- paste(tempdir(), "testS.ag", sep="/")
writeAsciiGrid(xS, tmpfl)
axS <- readAsciiGrid(tmpfl)
opar <- par(mfrow=c(1,2))
image(xS, main="before export")
image(axS, main="after import")

Thanks in advance

View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Help-with-ENFA-in-R-tp7583243p7583270.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

More information about the R-sig-Geo mailing list