Hi !!
Stanfield, Les (MNR) a écrit : > Thank you so much for coming to my rescue!: > > OK I have been able to open it (but only in the R editor. I assumed that we > had to generate our own files of XX.txt and YY.txt and bring them into R > before the program could run.... Is this right? > > Yon do not have to, but you can. I personally like to import the whole file I'm working (here "Table_11-3.txt") and go from there. If you feel more comfortable to do it another way there is no problem there ! > So I created two as tab delimited text files (Here they are). I am able to > bring them into R and when I edit them, they look fine. > > OK > This is the code to this stage: > > rdaTest <- function(YY.mat, XX.mat, WW.mat=NULL, > scale.Y=FALSE, testF=NULL, nperm=NULL, print.results=TRUE, > print.cum=FALSE) > { > library(MASS) > > # Read the data tables. Transform them into matrices Y, X, and W > YY.mat = -read.table("YY.txt") > XX.mat = -read.table("XX.txt") > > Y.mat=as.matrix(YY.mat) > >> X.mat=as.matrix(XX.mat) >> > bb<-edit(y.mat) > bb<-edit(x.mat) > > > But when I try to then convert these two files to mat files, nothing happens? > I'm assuming it has something to do with this step, but I can't figure it > out. Note: I tried creating base yy.mat and xx.mat files, by just changing > the file names, but that didn't work..... > > So is this the problem, When I look at the y.mat and x.mat they look no > different than the original txt files > > > Here I get a bit confused Here is what I propose: ### Load the whole file tab11.3<-read.table("Table_11-3.txt",header=TRUE,row.names=1) ### Extract the species (Y) and the environmental variables (X) from tab11.3 Y<-tab11.3[,1:6] X<-tab11.3[,7:10] ### Calculate the RDA coco<-rdaTest(Y,X,testF=TRUE,nperm=999) coco ### Draw the triplot graph.rdaTest(coco,plot.type="F") With these couple of lines you should get the same results as the ones presented in Legendre and Legendre (1998). > Les Stanfield > > Have a nice day !! Guillaume Blanchet ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.