convert_unit: Convert 'GreenFeed' Unit Number

View source: R/utils.R

convert_unitR Documentation

Convert 'GreenFeed' Unit Number

Description

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.

Usage

convert_unit(unit, t)

Arguments

unit

Number of the 'GreenFeed' unit(s). Can be a numeric, character, list, or vector.

t

Type of function (opts: 1 and 2).

Value

A character string of the unit(s) in the correct comma-separated format.

Examples

# Example 1: Providing unit as a character vector
unit <- c("592", "593")
convert_unit(unit, 1)

# Example 2: Providing unit as a single numeric
unit <- 592
convert_unit(unit, 1)

# Example 3: Providing unit as a comma-separated character string
unit <- "592, 593"
convert_unit(unit, 1)

# Example 4: Providing unit as a list
unit <- list(592, 593)
convert_unit(unit, 1)


greenfeedr documentation built on June 8, 2025, 11:38 a.m.