Split a row-binded data.frame (or tibble) into a Cropr format simulation list.

split_df2sim(df, add_cropr_attr = TRUE)

Arguments

df

A single data.frame or tibble containing simulation results (as created by bind_rows_sim). MUST include Dateand situation columns.

add_cropr_attr

A logical to indicate if the cropr_simulation attribute must be added to the resulting variable Set FALSE if you apply the function to observed data, TRUE otherwise (optional, default value = TRUE).

Value

A named list of data.frame for each situation, having the attribute cropr_simulation.

See also

bind_rows

Examples

if (FALSE) {
# Importing an example with three situations with observation:
workspace <- system.file(file.path("extdata", "stics_example_1"),
  package = "CroPlotR"
)
situations <- SticsRFiles::get_usms_list(
  usm_path =
    file.path(workspace, "usms.xml")
)
sim <- SticsRFiles::get_sim(workspace = workspace, usm = situations)

df <- bind_rows(sim)
split_df2sim(df)
}