Dear Alannie,
I think your problem comes from the handling of rasters as sp classes, not
from the actual ENFA methods. You should try to import the rasters
properly first, and check that they are actually valid
'SpatialPixelsDataFrame's. For instance, using rgdal:
library(rgdal)
bio1 <- readGDAL("bio1.asc")
bio2 <- readGDAL("bio2.asc")
bio3 <- readGDAL("bio3.asc")
bio <- cbind(bio1, bio2, bio3)
names(bio) <- c("bio1", "bio2", "bio3")
summary(bio)
image(bio)
spplot(bio)
...
The rest of the analysis should work as expected.
Mathieu.
--
~$ 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
---- Le mar., 27 mai 2014 21:56:19 -0400 alannie a ??crit ----
Hi,
I have been using ENFA in R to perform some analyses.
I have gotten the procedure to work before, however I can't seem to
replicate the code. This is very important since I would like to do this
analysis for a wide range of species.
Please advise of best practice for implementing the procedure.
Going from the very beginnings of the procedure:
1) read in .csv formatted locations data for the interested species
/code/ species1<-read.csv("species1.csv",head=T, sep=",")
species1coords<-SpatialPoints(species1)
2) read in raster files (I am using the bioclim variables converted into
ASCII)
/code/ b1<-read.asc("bio1.asc")
b2<-read.asc("bio2.asc")
b3<-read.asc("bio3.asc")
3) combine the maps into a single data frame and add slots to the
individual
maps
/code/ map<-cbind(b1 at data,b2 at data,b3 at data) *this form does not allow me
to visualize the maps using image(map)
map2<-cbind(b1,b2,b3) *this form, with out the slots,
does allow me to visualize the maps using image(map2)
4) following this step is making a histogram: hist(map, type = "l") I
usually cannot make one, but when I am able to make a histogram, the
variables show up on a single graph with the warning:
Warning messages:
1: In title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :
graphical parameter "type" is obsolete
2: In axis(1, ...) : graphical parameter "type" is obsolete
3: In axis(2, ...) : graphical parameter "type" is obsolete
4) The tab:
/code/ tab <- slot(map, "data"), I get this warning:
Error in slot(map, "data") :
cannot get a slot ("data") from an object of type "double"
Sometimes I get other warnings such as 'x is not numeric' or something
about
NA values.
I will spare the rest of the issues I face.
I believe the origins of these issues are the starting data inputs. I
would
appreciate any assistance in modifying the data inputs. I have tried to
look
through other resources, however I have not found anything to help with
my
specific issues.
If I can get this worked out, I also hope to post some code somewhere to
aide others in their SDM adventures.
Thank you for reading!
A
--
View this message in context:
http://r-sig-geo.2731867.n2.nabble.com/Ecological-Niche-Factor-Analysis-tp7586516.html
Sent from the R-sig-geo mailing list archive at Nabble.com.