Learn R Programming

nzffdr (version 2.1.0)

nzffdr_widen_habitat: Converts habitat variables to tidy wide format

Description

Converts habitat variables to tidy wide format columns and appends to original dataframe. Warning, with large (>100k rows) datasets this function slow (~30 seconds).

Usage

nzffdr_widen_habitat(
  fishd,
  cols_to_expand = c("habitatFlowPercent", "habitatInstreamCoverPresent",
    "habitatRiparianVegPercent", "habitatSubstratePercent")
)

Value

An NZFFD dataframe with added wide format columns for each of the selected habitat columns.

Arguments

fishd

an NZFFD dataframe returned from nzffdr_import.

cols_to_expand

the habitat columns to expand, can be any combination of "habitatFlowPercent", "habitatInstreamCoverPresent", "habitatRiparianVegPercent", "habitatSubstratePercent".

Examples

Run this code
nzffdr_widen_habitat(nzffdr::nzffdr_data)

Run the code above in your browser using DataLab