Questions tagged [vegan]

vegan is a package for use with R for the analysis of ecological communities, especially vegetation communities. It has tools for analyzing ecological diversity and for the multivariate analysis of communities (NMDS, pCCA, pRDA, etc.)

Vegan is an package that provides ordination methods, diversity analysis and other functions for community and vegetation ecologists.

Vegan contains many popular tools used in community ecology:

  • Diversity analysis: Shannon, Simpson, Fisher indices, Rényi diversities and Hill numbers.
  • Species abundance models: Fisher and Preston models, species abundance distributions.
  • Analysis of species richness: species accumulation curves, extrapolated richness.
  • Ordination: support and meta functions for NMDS, redundancy analysis, constrained correspondence analysis, constrained analysis of proximities (all three with partial analysis),
  • Support functions for ordination: dissimilarity indices, extended dissimilarities, Procrustes analysis, ordination diagnostics, permutation tests.
  • Ordination and environment: vector fitting, centroid fitting and smooth surface fitting, adding species scores as weighted averages, adding convex hull, SD ellipses, arrows etc. to ordination.
  • Dissimilarity analyses: ANOVA using dissimilarities, ANOSIM, MRPP, BIOENV, Mantel and partial Mantel tests.
  • Data standardization: Hellinger, Wisconsin, Chi-square, Beals smoothing.

Repositories

Vignettes

Other resources

Related tags

460 questions
16
votes
2 answers

ggplot2 boxplot with labelled rug

Can I make such a plot with ggplot2? # data require(vegan) data(dune) data(dune.env) # RDA RDA <- rda(dune ~ A1, data = dune.env) # extract species scores df <- data.frame(spec_scores = scores(RDA)$species[ , 1], taxa =…
EDi
  • 12,470
  • 2
  • 42
  • 54
14
votes
1 answer

RDA, Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric, when data is numeric?

I want to perform a rda in R, using vegan. My code looks like this: species<- read.delim("springspecies1.txt", header=T) envdata<- read.delim("springenv1.txt", header=T) RDA <- rda(species~Temperature + Salinity + O2 + Phosphate + Nitrate + Silica,…
user3420443
  • 297
  • 1
  • 3
  • 8
11
votes
4 answers

Plotting envfit vectors (vegan package) in ggplot2

I am working on finalizing a NMDS plot that I created in vegan and ggplot2 but cannot figure out how to add envfit species-loading vectors to the plot. When I try to it says "invalid graphics state". The example below is slightly modified from…
HFBrowning
  • 1,840
  • 3
  • 19
  • 35
11
votes
1 answer

Color-coding 95% confidence ellipses for centroids

I've plotted centroids for a Gower similarity index using the vegan{} package in R and would like to color code the ellipse fills based on factors in my original dataset. The centroids are for Month-Site combinations (and these are the only…
Margaret
  • 458
  • 1
  • 7
  • 20
10
votes
2 answers

how to interpret cca vegan output

I have performed a canonical correspondece analysis in R using the vegan package but i find the output very difficult to understand. The triplot is understandable, but all the numbers I get from the summary(cca) are confusing to me (as i've just…
user3420443
  • 297
  • 1
  • 3
  • 8
10
votes
1 answer

Plotting ordiellipse function from vegan package onto NMDS plot created in ggplot2

Instead of the normal plot function I am using ggplot2 to create NMDS plots. I would like to display groups in the NMDS plot using the function ordiellipse() from the vegan package. Example data: library(vegan) library(ggplot2) data(dune) #…
Dalmuti71
  • 1,369
  • 3
  • 14
  • 19
7
votes
2 answers

Color RDA vectors by groups in R

I'm plotting a series of RDAs in R, each of which has 10+ environmental vectors. The environmental variables each fall in to one of 5 categories. I'd like the vector colors to reflect these categories. I did it in a somewhat ghetto fashion by…
Jesse001
  • 826
  • 8
  • 29
7
votes
1 answer

How can I create a distance matrix containing the mean absolute scores between each row?

Given the matrix, df <- read.table(text=" X1 X2 X3 X4 X5 1 2 3 2 1 2 3 4 4 3 3 4 4 6 2 4 5 5 5 4 2 3 3 3 6 5 6 2 8 4", header=T) I want to create a distance matrix containing the absolute mean difference between…
Werner
  • 1,834
  • 3
  • 17
  • 30
6
votes
3 answers

summing 2 distance matrices for getting a third 'overall' distance matrix (ecological context)

I am ecologist, using mainly the vegan R package. I have 2 matrices (sample x abundances) (See data below): matrix 1/ nrow= 6replicates*24sites, ncol=15 species abundances (fish) matrix 2/ nrow= 3replicates*24sites, ncol=10 species abundances…
Pierre
  • 558
  • 4
  • 11
5
votes
1 answer

Error in G * t(hat) : non-conformable arrays

Trying to carry out a PERMANOVA using adonis in R. Added in my data table and factors, however, I keep getting the sample error - Error in G * t(hat) : non-conformable arrays There is no N/A data, and it works with a ready made matrix of data and a…
Bex
  • 51
  • 1
  • 2
5
votes
0 answers

"Error in G * t(hat) : non-conformable arrays" error in adonis(), in Vegan , in R

ANSWERED: A single NA value in any column in either data.frame can cause this error. I have a rather frustrating problem that I need help with. I'm trying to run a permanova in R, and I'm using adonis() in Vegan to do it. I have a species by…
FishyStats
  • 71
  • 2
  • 7
5
votes
1 answer

Overlaying clustering results on an ordination

I need to overlay the clusters generated from cutting a dendrogram a given level of similarity onto an ordination result (NMDS). I have been looking through ade4 and vegan without finding any obvious solutions to this problem. I am current using…
Elizabeth
  • 5,771
  • 16
  • 57
  • 88
4
votes
2 answers

R - "CAPdiscrim" and "lda" error "variable 1 appears to be constant within groups"

so I've been trawling through existing questions for solutions to this one, but to no avail. I have a dataset consisting of individuals (117), each with an observation from a different variable (12), and grouped by a factor variable with 8 levels. I…
4
votes
1 answer

R large distance matrix in vegan

I am running R 3.2.3 on a machine with 128 GB of RAM. I have a large matrix of 123028 rows x 168 columns. I would like to use a hierarchical clustering algorithm in R, so before I do that, I am trying to create a distance matrix in R using the…
jk22
  • 95
  • 1
  • 8
4
votes
1 answer

Barplot with SError from table

I am trying to plot grouped barplots from a table I generated, below. Group.1 S.obs se.obs S.chao1 se.chao1 Cliona celata complex 499.7143 59.32867 850.6860 65.16366 Cliona viridis 285.5000 51.68736 462.5465 …
André Soares
  • 199
  • 10
1
2 3
30 31