Creates numeric variables divided into equal sized groups
Arguments
- dat
Primary data containing information on hauls or trips. Table in FishSET database contains the string 'MainDataTable'.
- project
String, name of project.
- var
Numeric variable in
dat
to bin into a factor.- br
Numeric vector. If a single number, the range of
var
is divided intobr
even groups. If two or more values are given,var
is divided into intervals.- name
Variable name to return. Defaults to `bin`.
- labs
A character string of category labels.
- ...
Additional arguments passed to
cut
.
Details
Function adds a new factor variable, labeled by name, to the primary dataset. The numeric variable
is divided into equal sized groups if the length of br
is equal to one and into intervals if the
length of br
is greater than one.
Examples
if (FALSE) {
pollockMainDataTable <- bin_var(pollockMainDataTable, 'pollock', 'HAUL', 10, 'HAULCAT')
pollockMainDataTable <- bin_var(pollockMainDataTable, 'pollock', 'HAUL', c(5,10), 'HAULCAT')
}