[R-sig-Geo] Using the ENFA from adehabitatHS in R with sp classes

alannie agg18 at pitt.edu
Wed Aug 14 20:23:41 CEST 2013


Hi folks!

I have been having significant difficulty using the sp classes to perform
the ENFA in R. 
The objective of this posting is to inquire about how to "prepare data for
the ENFA," which in previous versions of the software package adehabitat was
carried out via 'data2enfa' and the 'dudi.pca' functions.

I have been using the code:

#Add table of coordinate locations

>locs<-read.table("xybartsiifolia.csv", header=TRUE, sep=",") 

#Convert to class sp

>xy.sp = SpatialPoints(locs)

#Import .asc variable maps into R. 

>bio1<-read.asciigrid("bio1.asc", as.image = FALSE, plot.image = FALSE,
colname = basename("bio1.asc"), proj4string = CRS(as.character(NA)))
>bio2<-read.asciigrid("bio2.asc", as.image = FALSE, plot.image = FALSE,
colname = basename("bio2.asc"), proj4string = CRS(as.character(NA)))

#etc

#Combine data maps

>join<- cbind(bio1 at data, bio2 at data, bio3 at data, etc)

After the last bit, I cannot go forward. 

I need to somehow combine the 'join' data which contains variable maps with
the 'locs' data which has species location data so that I can get the
principle component analysis from function dudi.pca. 

In the documentation for package adehabitatHS it says:

## We prepare the data for the ENFA
tab <- slot(map, "data")
pr <- slot(count.points(locs, map), "data")[,1]

and then goes on to do the PCA and ENFA

I have already tried working through the example 'lynxjura' multiple times
and have no greater understanding of what comprises the data (noted as
"data" in the example) or how to utilize the slot function in my own data
set. 

I would like assistance to put my data in the format for the PCA and the
ENFA. 

Thanks in advance for all assistance. 

Alannie






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



More information about the R-sig-Geo mailing list