Split a row-binded data.frame (or tibble) into a Cropr format simulation list.
split_df2sim(df, add_cropr_attr = TRUE)
A single data.frame or tibble containing simulation results
(as created by bind_rows_sim
).
MUST include Date
and situation
columns.
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).
A named list of data.frame
for each situation, having the attribute
cropr_simulation.
bind_rows
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)
}