propAbundPlots: propAbundPlots

View source: R/propAbundPlots.R

propAbundPlotsR Documentation

propAbundPlots

Description

#Make proportional abundance bar-plots, with a rank-order smoothing line

Usage

propAbundPlots(
  d,
  s,
  N,
  textYRange = c(0.5, 0.9),
  by = NULL,
  Ncol = NA,
  Nrow = NA
)

Arguments

d

Data frame or tibble

s

Species label column

N

Species count column

textYRange

Numeric vector with proportional y-range for plot text (default: c(0.5, 0.9))

by

Faceting column - usually site (default: NULL)

Ncol

Number of columns, if using facets

Nrow

Number of rows, if using facets

Value

A ggplot object

Examples

data(dune,package='vegan')

library(tidyverse)

dune <- dune %>% mutate(site=1:nrow(.)) %>%
  pivot_longer(cols = -site,names_to='species',values_to='counts')

  propAbundPlots(dune,s = species,N = counts)
  filter(dune,site<10) %>% #First 9 sites
    propAbundPlots(s = species,N = counts, by = site, Nrow=3, Ncol=3)


samuelVJrobinson/SRtools documentation built on Nov. 11, 2024, 12:37 p.m.