formathistab: Format histogram table

Description Usage Arguments Value See Also

Description

Creates a binary frequency histogram table by computing the proportion of records for which a selected column has a given value (in this study, the percentage length of rivers that are deemed intermittent) after binning the table by a continuous variable (e.g. river discharge).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
formathistab(
  in_dt,
  castvar,
  valuevar,
  valuevarsub,
  weightvar = 1,
  binfunc,
  binarg,
  binlabels,
  datname = NULL
)

Arguments

in_dt

data.table to bin.

castvar

(character) olumn that will be used to define bins — the equivalent of binvar in bin_dt.

valuevar

(character) variable to summarize (e.g. intermittency class).

valuevarsub

(character) value of valuevar to summarize (e.g. '1' for intermittent rivers)

weightvar

(character) variable to weigh proportion by. (e.g. river reach length).

binfunc

(character) binning approach. One of 'manual', 'equal_length', 'equal_freq'.

binarg

(numeric) binning argument, depends on binning approach (binfunc).

binlabels

(character vector) formatted labels for bins.

datname

(character) optional, adds a column to output table describing what the data describes (e.g. France)

Value

data.table with five columns:

See Also

used in compare_fr, compare_us, and compare_au


NaiaraLopezRojo/globalIRmap documentation built on Dec. 17, 2021, 5:19 a.m.