[R-sig-eco] location data format for adehabitat package

Christian Setzkorn christian at setzkorn.eu
Fri Oct 28 15:55:31 CEST 2011


I have a file in this format:

http://docs.codehaus.org/display/GEOTOOLS/ArcInfo+ASCII+Grid+format#ASCIIGrid

The first rows look like this:

ncols 1440
nrows 720
xllcorner -180.0
yllcorner -90
cellsize 0.25
NODATA_value -9999

Basically I have the world with 1440 'tiles' in x direction
(longitude) and 720 'tiles' in y direction (latitude). Each 'tile' is
a square with a length of 0.25 degrees. I think I have xllcorner and
yllcorner correct. I can draw this map like this in R:

library("adehabitat")
bio1 <- import.asc("D:/ENFA/data.asc")
maps <- as.kasc(list(data = bio1))
image(maps, col = cm.colors(256), clfac = list(Aspect = cl))

The map looks fine.

I would like to perform some ecological niche factor analysis (ENFA)
using the adehabitat package and am not too sure about the location
data. Basically I have them as longitudes and latitudes at the moment
but I could also generate then as 'tile index' (e.g. lower left corner
has the latitude -90 and longitude -180 so the 'tile index' would be
0, 0 - right?). Which is the correct location data format? I would use
ENFA code like this:

locs <- read.table("D:/ENFA/Locs.txt", header = TRUE, sep="\t")
dataenfa1 <- data2enfa(maps, locs)
pc <- dudi.pca(dataenfa1$tab, scannf = FALSE)
enfa1 <- enfa(pc, dataenfa1$pr,scannf = FALSE)
hist(enfa1)

I would appreciate any comments please. Thanks in advance.

Christian



More information about the R-sig-ecology mailing list