generate_fig5: Generate Figure 5

Description Usage Arguments References Examples

View source: R/generate_fig5.r

Description

This takes the posterior estimates for each species and the species trend estimates downloaded from the repository, calculates the average occupancy across the time frame of each species for whihch data were available and generates figure 5 of the associated paper. generage_fig5 function estimates species level average occupancy and generates figure 5.

Usage

1
2
generate_fig5(postdir, outdir, sp_trends, status = TRUE,
  save_plot = TRUE)

Arguments

postdir

A filepath specifying where the species level posteriors have been saved. If outputs have not been moved, this will be in a directory "/POSTERIOR_SAMPLES".

outdir

A filepath specifying where the outputs of the function are to be saved.

sp_trends

A dataframe, downloaded from the repository which details the species level trends in occupancy and the years for which data were avaialble for each species.

status

Logical. If TRUE the species name being worked on will be printed to the console.

save_plot

Logical. If 'TRUE', the plot will be saved as a PDF file within the 'outdir'. Default is 'TRUE'.

References

Outhwaite et al (in prep) Complexity of biodiversity change revealed through long-term trends of invertebrates, bryophytes and lichens.

Outhwaite, C. L., Powney, G. D., August, T. A., Chandler, R. E., Rorke, S., Pescott, O., … Isaac, N. J. B. (2019). Annual estimates of occupancy for bryophytes, lichens and invertebrates in the UK (1970-2015). NERC Environmental Information Data Centre. https://doi.org/10.5285/0ec7e549-57d4-4e2d-b2d3-2199e1578d84

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 

# Run generate_fig5 function to produce plot of average occupancy against
# trend in occupancy.
# datadir should be the filepath of where the posterior samples are saved.
generate_fig5(postdir = "/POSTERIOR_SAMPLES", outdir = getwd(),
sp_trends = read.csv(paste0(datadir, "/Species_Trends.csv")))



## End(Not run)

CharlieOuthwaite/UKBiodiversity documentation built on Jan. 24, 2020, 12:45 p.m.