convert_unit {greenfeedr} | R Documentation |
Processes the parameter unit to format it correctly as a comma-separated string, regardless of whether it is provided as a numeric, character, or list/vector.
convert_unit(unit)
unit |
Number of the 'GreenFeed' unit(s). Can be a numeric, character, list, or vector. |
A character string of the unit(s) in the correct comma-separated format.
# Example 1: Providing unit as a character vector
unit <- c("592", "593")
convert_unit(unit)
# Example 2: Providing unit as a single numeric
unit <- 592
convert_unit(unit)
# Example 3: Providing unit as a comma-separated character string
unit <- "592, 593"
convert_unit(unit)
# Example 4: Providing unit as a list
unit <- list(592, 593)
convert_unit(unit)