Skip to contents

`update_action_value()` updates agricultural sale prices and production costs from an action.value.table type of data.frame using price and production indexes for different years.

Usage

update_action_value(
  action_value,
  destination,
  year_new,
  year_origin = "2016",
  index_price,
  index_prod,
  global_price = FALSE,
  global_price_name = "global",
  global_prod_id = "010776857",
  prod_task = c("harvest", "sowing", "treatment", "replanting", "oversowing",
    "chemical.harvest"),
  retrieve_info = FALSE,
  verbose = FALSE
)

Arguments

action_value

data.frame, base action values, including 'sale.price' and production cost components (e.g., 'harvest', 'sowing', 'treatment'). This data.frame typically comes from an `action.value.table.csv` file such as system.file("extdata/default/stat/action.value.table.csv", package = "floodam.agri")

destination

character, directory path(s) where the updated action value tables will be saved.

year_new

character, year(s) for which the action values need to be updated.

year_origin

character, base year used as the reference point for calculating index adjustments. Default to "2016".

index_price

data.frame or list of data frames, price indexes. If `global_price` is `FALSE`, this should be a list where each element is a data.frame of price indexes for a specific culture. If `global_price` is `TRUE`, it can be a single data.frame containing a global price index.

index_prod

data.frame, production index. Used to adjust production costs.

global_price

boolean, if `TRUE`, a single global price index is used for all cultures. If `FALSE`, culture-specific price indexes are used based on names of `index_price`. Default is `FALSE`.

global_price_name

character, name of the global price index within the `index_price` list. Default to "global". Only used if `global_price` is `TRUE`.

global_prod_id

character, ID of the global production INSEE series, default to "010776857".

prod_task

character, name of production tasks to be updated. Default set to `c("harvest", "sowing", "treatment", "replanting", "oversowing", "chemical.harvest")`.

retrieve_info

boolean, return detailed information about the updates (coefficients, index values) or not. Default to `FALSE`.

verbose

boolean, will floodam tell what it is doing, default to TRUE

Value

If `retrieve_info` is `TRUE`, the function returns a list containing:

sale_price:

A data frame with the updated sale prices, coefficients, and index values.

production:

A data frame with production cost information, coefficients, and index values.

Otherwise, the function saves the updated action value table to a CSV file in the specified `destination` and returns nothing.

Details

The function calculates updated sale prices and production costs by applying price index and production cost ratios to the base sale prices. It handles both global and culture-specific price indexes.