[R-sig-Geo] convex hull on PCA results of BIOCLIM variables
sarah.goslee at gmail.com
Wed May 9 16:50:44 CEST 2012
We don't know anything about your data. Providing a small reproducible
example would go a long way toward making it possible to answer your
question. The help file for s.chull gives some fake data; perhaps you
could use that to more clearly describe what you are doing and what is
Or you could use dput() to give us a small portion of your actual data.
On Wed, May 9, 2012 at 4:43 AM, Julian WITTISCHE <jwittische at hotmail.com> wrote:
> Dear all,
> I have a problem to plot a convex hulls on PCA results. The PCA has reduced the 19 BIOCLIM variables to two axes and I want to plot a convex hull to be able to illustrate the environmental space overlap of two species.
> This is my script:
> #Import data
> batrabio<-read.table(file="Bioclimfull.txt", sep="\t", header=TRUE);batrabio<-batrabio[,c(1,4:22)]; #To select only species name and the 19 bioclim variables columns batrapair<-batrabio[batrabio$SCIENTIFIC_NAME=="Batrachoseps minor"| batrabio$SCIENTIFIC_NAME=="Batrachoseps incognitus",]; #To select two species to compare and illustrate their environmental space
> batrapair<-unique(batrapair[,]);#To select only unique localities
> #Run PCAs based on columns with climate data
> pca.ade4<-dudi.pca(batrapair[,2:20], center=T, scale=T, scannf=T); 2;#number of axes
> #Create convex hull using PCA axes, and colour-code points according to species name
> convex.hull<-s.chull(pca.ade4$li,as.factor(batrapair$SCIENTIFIC_NAME),add.plot=F, grid=F, clabel=0, origin=c(0,0),addaxes=T,col=c("red","blue"), cpoint=.65)
> I get the axes, the grid, the species name label but nothing else. I would greatly appreciate any advice as I have not been able to figure myself how to solve this problem.
> Thank you very much,
More information about the R-sig-Geo