RL_code_fill: Fill Out Level 1 or 2 Habitat Codes

Description Usage Arguments Details Value Author(s)

View source: R/RL_code_fill.R

Description

Optionally fill out Level 2 habitat codes if Level 1 codes exist and vice versa.

Usage

1
2
3
4
5
6
7
8
9
RL_code_fill(
  x,
  level1.recode = T,
  level2.recode = T,
  subset = 1,
  parallel = T,
  num.cores = parallel::detectCores() - 1,
  verbose = 1
)

Arguments

x

A wide format dataframe with one column per habitat category. As output by RL_fetch().

level1.recode

(optional) Logical. If Level 2 habitat info exists, should the corresponding Level 1 habitat be given the same info? See Details. Default is TRUE.

level2.recode

(optional) Logical. If Level 1 habitat info exists, should the corresponding Level 2 habitats be given the same info? See Details. Default is TRUE.

subset

(optional). Numeric. Specify proportion of x to run for between 0 and 1. Defaults to 1.

parallel

(optional) Logical. If TRUE uses multiple cores. Default is TRUE.

num.cores

(optional) Numeric. Specify number of cores to use if running in parallel. Default is number of CPU cores available - 1.

verbose

(optional) Numeric. If 0 gives no progress update, if 1 prints progress bar, if 2 prints 1 row per task completed. Default is 1.

Details

The level1.recode parameter will fill upstream Level 1 habitat categories if any Level 2 categories have habitat information. e.g. if habitat category 2.1 (Dry Savanna) is suitable and of major importance (coded as 31), habitat category 2 (Savanna) will be filled with this info too.

Similarly, level2.recode will fill all downstream Level 2 habitat categories if the corresponding Level 1 category is filled. e.g. if if habitat category 2 (Savanna) is suitable and of major importance (coded as 31), habitat categories 2.1 (Dry Savanna) and 2.2 (Moist Savanna) will be given the same information.

NOTE: Running this function multiple times will fill out Level 1/Level 2 habitats which only exist because of a previous function call. It is advisable only to run this function once.

Value

A dataframe in wide format (one column per habitat type and one row per species' season).

Author(s)

Matt Lewis, matthewlewis896@gmail.com


matthewlewis896/redlistManipulatr documentation built on Jan. 22, 2022, 1:01 p.m.