append_soil_mod: Append Soil Mod

Description Usage Arguments Details Value Examples

View source: R/append_soil_mod.R

Description

Appends a column for soil modification (such as fertilizer or speed-gro) to the crop data for later use in calculating what fits in season (using 'filter_to_season()' and 'filter_to_days()') and in calculating what the expected sale price is (using 'calc_crop_sale_price()').

Usage

1
append_soil_mod(crop_data = croptimizer::crops, soil_mods = NULL)

Arguments

crop_data

a data.frame containing the data about the crops, expected to contain the same columns as 'croptimizer::crops'

soil_mods

accepts NULL, a singleton character for a soil modifier, a vector of length = nrow(crop_data) without names, or a names vector of any length where names are unique and represent crop modifiers

Details

If soil_mods are NULL, "Normal" is repeated. If soil_mods is a singleton, it is repeated. If soil_mods is a non-named vector, cbind is attempted. If soil_mod is a named vector, names should be a crop name (e.g. "Blueberry") and a left join will be attempted.

Value

crop_data with a soil_mod column appended based upon user input if provided, and containing "Normal" if not

Examples

1
2
3
4
5
6
7
## Example with named soil mods
  soil_mods <- c("Blueberry" = "Quality Fertilizer",
  "Bok Choy" = "Basic Fertilizer",
  "Cauliflower" = "Deluxe Fertilizer",
  "Corn" = "Speed-Gro")
  soil_mod_data <-
  append_soil_mod(soil_mods = soil_mods)

aftonsteps/croptimizer documentation built on Jan. 28, 2021, 12:50 p.m.