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

585 questions
16
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
  • 2,196
  • 3
  • 23
  • 42
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
  • 13,160
  • 2
  • 48
  • 57
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
  • 2
  • 3
  • 8
12
votes
2 answers

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,509
  • 3
  • 15
  • 19
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
  • 2
  • 3
  • 8
10
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
  • 518
  • 1
  • 8
  • 20
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
  • 924
  • 1
  • 13
  • 37
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 Hertzog
  • 2,002
  • 3
  • 24
  • 36
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
  • 568
  • 5
  • 11
5
votes
1 answer

R S3 method not exported from namespace

Why do I have this error message : > vegan::reorder.hclust Error: 'reorder.hclust' is not an exported object from 'namespace:vegan' While this S3 method is well available. For example if I type help(reorder.hclust, package = "vegan") I obtain the…
Gilles San Martin
  • 4,224
  • 1
  • 18
  • 31
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
2 answers

accumulation curve in R

I have data of species at 4 sites over several months. I have successfully created accumulation graphs using package vegan in R but I would like to plot all 4 sites on one graph. At first I had a data sheet with all sites and months but the when I…
MyNameisTK
  • 209
  • 1
  • 2
  • 15
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
  • 4
  • 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
  • 6,391
  • 17
  • 62
  • 90
4
votes
1 answer

Trouble understanding veganCovEllipse covariance ellipse calculation

I'm having issues understanding how the veganCovEllipse() function from the vegan package v 2.5-7 calculates an ellipse. veganCovEllipse <- function (cov, center = c(0, 0), scale = 1, npoints = 100) { theta <- (0:npoints) * 2 * pi/npoints …
olliejay00
  • 43
  • 3
1
2 3
38 39