RL_reformat_long: Reformat wide format data to long format

Description Usage Arguments Details Value Author(s)

View source: R/RL_reformat_long.R

Description

Reformat wide format data (they way RL_fetch() retrieves data) to long format.

Usage

1
RL_reformat_long(x, na.rm = TRUE)

Arguments

x

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

na.rm

(optional). Logical. Remove NA rows to compress output. See Details. Defaults to TRUE.

Details

If na.rm is TRUE (the default) then rows lacking habitat information will be removed. On pivoting, all habitat columns are retained - even those with no information - meaning that the output has many NA rows where a species is not found at all in a habitat (e.g. polar bears in Hot Desert). This is normally undesirable, so these rows are removed by default. If you would like to keep these rows then set na.rm to FALSE.

Value

A dataframe in long format (one row per habitat type).

Author(s)

Matt Lewis, matthewlewis896@gmail.com


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