Reputation: 31
I am performing a CAP analysis (vegan, R) on a species abundance table, with 2 explaining factors (Location and Complexity_Watson) and one explaining continuous variable (Depth..m.). Below you will find some of my code:
species.cap=capscale(Species.MVA.DOV ~ Location + Depth..m. +
Complexity_Watson, data=Habitat.MVA.DOV, distance="bray", na.action=na.omit)
However, summary(species.cap)
yields the location & complexity as both constraining (continuous) variables and constraining factors.
How can I make sure it only enters them as factors? (I tried adding factor()
but that yielded the same result).
When I want to plot the environmental variables, it creates both arrows and centroids for location and complexity, while I only want centroids (and an arrow for depth).
Could someone help me out?
Upvotes: 3
Views: 863
Reputation: 460
Use as.factor
to change the variables to factors in the dataframeHabitat.MVA.DOV
Habitat.MVA.DOV$Location <- as.factor(Habitat.MVA.DOV$Location)
Habitat.MVA.DOV$Complexity_Watson <- as.factor(Habitat.MVA.DOV$Complexity_Watson)
For the plotting question you have to realize that plot
is calling plot.cca
. Use the help section in plot.cca
to pinpoint the solution to your question.
I think what you want is:
plot(species.cap, display = "cn") #cn stands for centroid, see help for other options
?plot.cca # gets you to the documentation/help on plot.cca
Also, the vegan tutorial is a great reference with helpful examples.
Upvotes: 1