split_df2sim: Split data.frame into Cropr format

View source: R/cropr_bind_split.R

split_df2simR Documentation

Split data.frame into Cropr format

Description

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

Usage

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

## Not run: 
# 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)

## End(Not run)

SticsRPacks/CroPloteR documentation built on April 1, 2024, 9:25 a.m.