resFig2: Create Figure 2

Description Usage Arguments Value Examples

View source: R/resFig2.R

Description

Generates Figure 2. Returns list with ggplot2 figures. Optionally exports as png.

Usage

1
2
resFig2(listsf = NA, listTab = NA, pBasin = NA, pBasinSp = NA,
  pBasinAcc = NA, rastAc = NA, make_png = FALSE)

Arguments

listsf

List of five sf objects created by prepTabcover.R

listTab

List of data.frames created by resTab.R

pBasin

Subbasin cover polygons.

pBasinSp

Extent polygon covering subbasins in species range of occurance.

pBasinAcc

Subbasin cover polygons with human access proportion, from demog_river.R (SAGA (grid tools, grids stats for poly)).

rastAc

Acessibility raster.

make_png

Logical (TRUE/FALSE). Generate png version of Fig 1.

Value

List of plots created by ggplot2. Optionally exports as png.

Examples

 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
## Not run: 
# Load shapefiles needed
# These large files are not available via github package. 
# Download "shapes.zip" from :
# https://drive.google.com/open?id=1QQArA7pPLemUVQTKx7PxigsQXKpOG0YQ
# For the code below to work, 
# extract files in "shapes.zip" to cmartr/inst/shape .
# This function needs 3 shapefiles as listed below.

# Subbasin cover polygons
B <- system.file("shape/amazon_orinoco.shp", package="cmartr")
# Extent polygon covering subbasins in species range of occurance.
# From prepBasin.R .
Bsp <- system.file("shape/speciesBasin.shp", package="cmartr")
# Human access from demog_river.R . Need to add earlier in prep stages.
BAc <- system.file("shape/basinsum4326.shp", package="cmartr")
# Human aceesibility raster
ras1 <- system.file("raster/uas.grd", package="cmartr")
# run
lsf <- prepTabcover(pBasin = B, pBasinSp = Bsp, 
  pBasinC = BC, riv = rin, make_shape = FALSE)
lt <- resTab(listsf = lsf)
lfig2 <- resFig2(listsf = lsf, listTab = lt, pBasin = B, 
  pBasinSp = Bsp, pBasinAcc = BAc, rastAc = ras1, make_png = FALSE)


## End(Not run)

darrennorris/cmartr documentation built on May 23, 2020, 10:10 p.m.