Description Usage Arguments Details Value Examples
View source: R/site_replication.R
Functions to examine the number of temporal replicates
contained within each spatial replication level of a dataset.
pplr_site_rep_plot
plots the temporal replicates available for
each site.
pplr_site_rep
produces logical vectors that identify the spatial
replicates with enough temporal replication, or summary tables.
1 2 3 4 | pplr_site_rep(input, freq = 1, duration = 10, rep_level = 1,
return_logical = TRUE)
pplr_site_rep_plot(input, return_plot = FALSE)
|
input |
An object of produced by |
freq |
A number corresponding to the desired annual frequency of
replicates. Studies that are replicated more frequently will be
included in the counts and those that replicated less frequently will be
excluded.
If |
duration |
An integer corresponding to the desired number of yearly replicates. Rows containing site information from sites with more replication will be included, while those with less will be excluded. |
rep_level |
An integer corresponding to the level of spatial
replication over which verify yearly temporal replication. Values between 1 and 5
are possible (though higher levels may not be present for some datasets).
Higher values correspond to higher levels of spatial nestedness.
The default value of |
return_logical |
logical; if |
return_plot |
A logical indicating whether to return a copy of the
|
pplr_site_rep_plot
produces a scatterplot showing the sites
(spatial_replication_level_1
) and years for which data is available.
pplr_site_rep
works with any level of spatial replication and produces
either a summary table of temporal replication or a logical vector that can be used
to subset a data set based on the desired frequency and length of time.
pplr_site_rep_plot
: input
object (invisibly) or a
ggplot2
object. Use return_plot
to control.
pplr_site_rep
: A tbl
or a logical vector of length
dim(input)[1]
. Use return_logical
to control.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ## Not run:
library(ggplot2)
library(dplyr)
# produce logical vector and subset using it. This can also be piped into a
# the plotting function for visiualization
good_studies <- pplr_get_data(lterid == 'SEV') %>%
.[pplr_site_rep(input = .,
duration = 12,
rep_level = 3), ] %>%
pplr_site_rep_plot()
# Or, make a neat summary table and decide where to go from there
SEV <- pplr_get_data(lterid == 'SEV')
rep_table <- pplr_site_rep(input = SEV,
freq = 0.5,
duration = 12,
return_logical = FALSE)
# pplr_site_rep_plot ---------------
# create an unmodified figure
BNZ <- pplr_get_data(lterid == 'BNZ')
pplr_site_rep_plot(BNZ)
# Return the figure instead of the data for subsequent modification
Antarctica <- pplr_get_data(lterid == 'PAL')
pplr_site_rep_plot(Antarctica,
return_plot = TRUE) +
ggtitle("Penguins Rock!")
# Use within pipes. Cannot return and modify the figure this way.
pplr_get_data(lterid == 'SEV') %>%
pplr_site_rep_plot(return_plot = FALSE) %>%
pplr_report_metadata()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.