cover_calc | R Documentation |
Convert the number of observations for each species or non-species to proportion or percent cover within each row based on the total number of observations in each row. Useful for quadrats with varying numbers of observations to calculate each row's percent cover all at once.
cover_calc(data, spp, prop = TRUE, total = FALSE)
data |
A data frame with each row representing a sampling unit (ex. a quadrat or photo). |
spp |
The column names containing all observations to be used in the proportion calculation. It is important to note that the proportions will be scaled to the total observations in these columns for each quadrat. |
prop |
If |
total |
If |
A data frame containing scaled observation cover.
#create data set for example Sites <- as.factor(c("One", "One", "Two", "Two", "Three", "Three")) Transect <- as.factor(c("1-Shallow", "2-Shallow", "1-Shallow", "2-Shallow", "1-Shallow", "2-Shallow")) Acropora.sp <- c(1, 2, 3, 4, 5, 6) Gardineroseris.sp <- c(6, 1, 2, 3, 4, 5) Psammocora.sp <- c(5, 6, 1, 2, 3, 4) Leptastrea.sp <- c(4, 5, 6, 1, 2, 3) coral_cover <- data.frame(Sites, Transect, Acropora.sp, Gardineroseris.sp, Psammocora.sp, Leptastrea.sp) cover_calc(data = coral_cover, spp = names(coral_cover[3:6]), prop = TRUE, total = TRUE) cover_calc(data = coral_cover, spp = names(coral_cover[3:6]), prop = FALSE, total = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.