veganrda

RDA in R - plot has row1, row2, row3... etc in label names for sites instead of just 1, 2, 3


So I am trying to plot species, site and environmental data in R by using RDA with vegan package. In my RDA R has automatically named sites in site scores tables as row1, row2... etc. Can I change these somehow? Or can I change in the plot so that for the site label I would get just the row number/ID instead of a "row1".

My input species data does not have a column for site labels. Sites are the rows and they are in the right order so site names should just be 1, 2, 3, 4...

I am using R studio and plot with plot() and ordiplot()

I have the same problem with PCA but then I get sit1, sit2, sit3.. in my plot instead of just 1, 2, 3.. I have also done cap (with the same species and environmental data) and in cap plot my site/row names are displayed correctly (1,2, 3..).

I am a newbie, be kind :)

Example:

ordiplot (tbRDA, type ="n", family = "A")
points(tbRDA, display = "species", pch = 3, cex = 0.5, col = "dark grey", family = "A")
text(tbRDA, display = "species", col = "dark grey", cex = 1, family = "A")
text(tbRDA, display="bp", col=1, family = "A")
points(tbRDA, display ="sites", family = "A")
text(tbRDA, display = "sites", col = "dark grey", cex = 1, family = "A")

/// EDIT

Example on how I read my data (there are species data and environmental data tables, input data tables don't have row names):

species_data = read.csv("species_data.csv", sep = ";", dec = ",")

I have done hellinger transformation for the species data.

I checked the row names for species data and env data and both are correct ([1] "1" "2" "3" "4" "5" "6" "7").

Example of the RDA:

tbRDA_species <- rda (spe.hell ~ env_variable_1 + env_variable_2 + env_variable_3, data = env_data)

Solution

  • If you want to have specific row and column names, you should set them. You do not add a new column of row names, but you set names with commands rownames() and colnames. These functions have help pages where you find more information.

    Another alternative is to first make an empty plot (plot(..., type="n")) and then add elements with text(..., labels=vector_of_my_names). See help on ordiplot and plot.cca in vegan.

    Vegan indeed makes up names if you do not provide them. The reason is that these ordination methods provide and plot several kind of scores. If your data has no names, no names would be plotted with text (because there is no text). If sites (rows) are simply numbered, how would you separate numbers identifying for rows from numbers identifying columns? Therefore functions add a three-character string identifying the score type so that you can separate different types of scores in one plot. However, this happens only if you do not provide names. So provide names using rownames and colnames.