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

Mathieu Basille basille at ase-research.org
Wed Apr 10 17:57:42 CEST 2013


Jonathan,

Again, this is no more an adehabitat question: the whole idea of the new 
series of packages (including adehabitatHS) is to rely on spatial R classes 
that are available with sp. All adehabitat functions to handle maps (such 
as as.kasc) have thus been removed.

This said, this should help:

library(maptools)
x <- readAsciiGrid(system.file("grids/test.ag", package="maptools")[1])
class(x at data)
head(na.omit(x at data))
x at data <- cbind(x at data, x at data * 2)
head(na.omit(x at data))

As you can see, the data attributes are stored in a data frame. One 
possibility for you is then to import all your variables using 
readAsciiGrid, and then cbind all @data into one (assuming all your rasters 
have the same resolution and extent). There might be other solutions as well...

Lastly, read.csv is fine to import the point data. You'll then need to 
convert the data frame to SpatialPoints using e.g. the function 
'SpatialPoints'.

Mathieu.


Le 04/10/2013 10:39 AM, JonathanAronson a écrit :
> perhaps I can clarify my question a lit bit further:
>
> With the adehabitat package I used the function as.kasc to create a single
> data frame with my 15 variables as Ive shown below:
>
> map<- as.kasc(list(bio_01 = var1, bio_12 = var2, Aridity = var3, altitude =
> var4, unpalatable = var5, thicket = var6, succulent = var7, shrubland =
> var8, rainforest = var9, mosaic = var10, mopane = var11, misavanna = var12,
> hydro = var13, fynbos = var14, desert = var15))
>
> However, in the adehabitatHS, what is the equivalent function to use to
> create the data frame which is equivalent to the lynxjura$map spatial pixel
> data frame? There is no as.kasc function. I have used the readAsciiGrid
> function in Maptools but I can only do that individually for each variable.
> How then can I combine these into a single data frame? I have thought of
> using the stack() function in the raster package.
>
> I am really stuck here
> Thanks to anyone who can help
> Jonathan
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Help-with-ENFA-in-R-tp7583243p7583272.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 

~$ whoami
Mathieu Basille, PhD

~$ locate --details
University of Florida \\
Fort Lauderdale Research and Education Center
(+1) 954-577-6314
http://ase-research.org/basille

~$ fortune
« Le tout est de tout dire, et je manque de mots
Et je manque de temps, et je manque d'audace. »
  -- Paul Éluard



More information about the R-sig-Geo mailing list