View source: R/ggRichnessWrapper.R
| ggRichnessWrapper | R Documentation |
BeeBDC::ggRichnessWrapper() takes data output from BeeBDC::iNEXTwrapper() and
BeeBDC::ChaoWrapper() to produce plots for multiple groups in one go. The plots can be
multiple per page and across multiple pages.
ggRichnessWrapper(
iNEXT_in = country_iNEXT,
iChao_in = NULL,
filterOut = NULL,
type = 1,
se = TRUE,
facet.var = "None",
color.var = "Order.q",
grey = FALSE,
legendPerPlot = FALSE,
show_iNEXT = TRUE,
showPercent = TRUE,
ChaoColour = "#55AD9B",
iNEXTcolour = "#FD9B63",
Chao_estimate = "iChao1 (Chiu et al. 2014)",
nrow = 3,
ncol = 4,
labels = NULL,
fileName = "richnessPlots",
outPath = tempdir(),
base_width = 8.3,
base_height = 11.7,
dpi = 300,
...
)
iNEXT_in |
a list of |
iChao_in |
a list of R data created |
filterOut |
Character. A list of sites/countries to exclude from plotting; for example, because sample size was inadequate. Default = NULL. |
type |
three types of plots: sample-size-based rarefaction/extrapolation curve ( |
se |
a logical variable to display confidence interval around the estimated sampling curve.
From |
facet.var |
create a separate plot for each value of a specified variable:
no separation |
color.var |
create curves in different colors for values of a specified variable:
all curves are in the same color ( |
grey |
a logical variable to display grey and white ggplot2 theme.
From |
legendPerPlot |
Logical. If TRUE, remove the legend from each plot. Default = FALSE |
show_iNEXT |
Logical. If TRUE, show the estimate and 95% CIs if specified for iNEXT. Default = TRUE. |
showPercent |
Logical. If TRUE, show the prrcentage increases. Default = TRUE. |
ChaoColour |
Character. The to be used to graph Chao estimates (95% confidence intervals are shown with reduced opacity). Default = "#55AD9B". |
iNEXTcolour |
Character. The to be used to graph iNEXT estimates (95% confidence intervals are shown with reduced opacity). Default = "#FD9B63". |
Chao_estimate |
Character. The name of the Chao estimate to use from those calculated in
|
nrow |
Numeric. The number of rows per figure. Figures (that don't fit in the nrow*ncol grid) will be saved into additional files. Default = 3. |
ncol |
Numeric. The number of columns per figure. Figures (that don't fit in the nrow*ncol grid) will be saved into additional files. Default = 4. |
labels |
Character. The labels for each sub-plot (a, b, c, ...). The default is NULL, which will provide labels a-z as required. |
fileName |
Character. Prefix to the output files. Default = "richnessPlots". |
outPath |
Character. The fodler in which to save the plots. Default = |
base_width |
Numeric. The width, in inches, to save the plot. Default = 8.3. |
base_height |
Numeric. The height, in inches, to save the plot. Default = 11.7. |
dpi |
Numeric. Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types. Default = 300. |
... |
other arguments passed on to methods. Not currently used.
From |
Saves pdf objects and returns a summary table for all levels
## Not run:
data(beesCountrySubset)
# Transform data for iNEXT
data_nextWrapper <- beesCountrySubset %>%
dplyr::group_by(scientificName, country_suggested) %>%
dplyr::count()
# Calculate iNEXT with the wrapper function
output_iNEXTwrapper <- BeeBDC::iNEXTwrapper(data = data_nextWrapper,
variableColumn = "country_suggested",
valueColumn = "n",
mc.cores = 1)
# Transform data for iChao
data_iChao <- beesCountrySubset %>%
dplyr::group_by(scientificName, country_suggested) %>%
dplyr::count() %>%
dplyr::select(scientificName, country_suggested, n) %>%
tidyr::pivot_wider(names_from = country_suggested,
values_from = n,
values_fill = 0) %>%
## Create the rownames
tibble::column_to_rownames("scientificName") %>%
dplyr::tibble()
# Run the wrapper function
output_iChaowrapper <- BeeBDC::ChaoWrapper(data = data_iChao,
datatype = "abundance",
k = 10,
conf = 0.95,
mc.cores = 1)
# Make the plots!
plot_summary <- BeeBDC::ggRichnessWrapper(
iNEXT_in = output_iNEXTwrapper,
iChao_in = output_iChaowrapper,
nrow = 2,
ncol = 2,
labels = NULL,
fileName = "speciesRichnessPlots",
outPath = tempdir(),
base_width = 8.3,
base_height = 11.7,
dpi = 300)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.