[R] CCA with Vegan - Plot problem

Gavin Simpson gavin.simpson at ucl.ac.uk
Fri Nov 9 14:37:37 CET 2012


On Fri, 2012-11-09 at 05:16 -0800, rumble14 wrote:
> Thanks for replying. Apologies for not putting the code, I have not deviated
> from that used on the website I linked to.
> 
> >Can you show the exact code you used please? 
> 
> I am using:
> #below is Species_1 etc
> org <- read.table ("Organisms.S", header=TRUE, row.names=1)
> #below is environmental variables
> env<-read.table ("Environment.S, header=TRUE)
> attach(env)
> library(vegan)
> cca.1<-(org~Temp+Water+etc)
> cca.1

Don't do that - it is an abuse of the formula interface and an
abomination to attach such objects to the search path.

This isn't actually doing anything (well, it is, but it is not a CCA):

cca.1<-(org~Temp+Water+etc) 

There is no function call. And your use of `+ etc` suggests this isn't
the **actual** code you ran and I did ask for that. You should use:

cca.1 <- cca(org ~ ., data = env)

assuming you want all variables in `env` in the model - not that that is
a good thing but that is a statistical issue not an R one!

Can you show me - probably *off list* including the actual data files
(which I promise to delete after we solve the problem) - the code you
use and I can take a look but before you send anything to me in an email
make sure you can paste the exact same code into R and have it run

G

> At this point I have noticed (this morning) that I should be getting the CCA
> come up here, and this is working with test data but not my actual data
> which is formatted in exactly the same way.
> If I type:
> 
> cca(formula = org ~ Temp + Water+etc, data = org)
> 
> at this point, I get what looks like but (you're right) might not be an
> output.
> For the graph I was then trying to use:
> 
> cca1.plot <- plot(cca.1,choices=c(1,2))
> 
> at which point I get error messages.
> 
> 
> >Also, not sure why you are 
> attaching anything 
> 
> As I said, I'm quite new to R. It does so on the tutorial linked so  had
> assumed it was to do with being able to access the parameters Temp etc.
> 
> H
> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/CCA-with-Vegan-Plot-problem-tp4649012p4649045.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.
> 

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list