Dear Alannie,

Obviously all these "data"s are confusing :)
The 'enfa' example uses a dataset call 'lynxjura' (not 'data'), which is a list with several elements. One of these elements is the maps, with the name 'map' (singular!). This is what you want to achieve. This is simply a SpatialPixelsDataFrame, but as far as I can tell, a SpatialGridDataFrame will do too (if you want to know more about the differences between these two, check the sp vignette).

So, following your example, just replace "map" by "join", and it should work. The 'slot(map, "data")' line extracts the data frame storing the data of the map, since the dudi.pca and enfa functions do not directly need the spatial attributes.

Hope this helps,
Mathieu.


Le 08/14/2013 02:23 PM, alannie a écrit :
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@data, bio2@data, bio3@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.

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@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

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to