save_sensi: Save and Read sensitivity analysis of STICS

View source: R/save_read_sensitivity.R

save_sensiR Documentation

Save and Read sensitivity analysis of STICS

Description

Helper functions to conveniently read or save sensitivity outputs from the sensitive_stics() function

Usage

save_sensi(
  x,
  dirpath = getwd(),
  device = "png",
  width = NULL,
  height = NULL,
  units = c("in", "cm", "mm"),
  ...
)

load_sensi(dirpath = getwd())

Arguments

x

The output from the sensitive_stics() function

dirpath

Path to the directory where to save the plots and objects

device

Device to use for the ggplot2::ggsave() function that is used under the hood. From its documentation: Can be either a device function (e.g. png()), or one of "eps", "ps", "tex" (pictex), "pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only)

width, height

Plot dimensions in units parameter units

units

Units to use for the plot size parameters them (see details and example)

...

Further parameters to pass to ggplot2::ggsave()

Details

The function first save all the gg_objects from the output of sensitive_stics() as images, save the full xobject using base::saveRDS(), and write a readme file for convenience.

See Also

ggplot2::ggsave(), base::saveRDS() and base::readRDS()

Examples

## Not run: 
library(sticRs)

# Making a sensitivity analysis on two parameters:

sens=
  sensitive_stics(dir.orig = "0-DATA/dummy/SC_Wheat",
                  dir.targ = "Sensitivity",
                  stics = "0-DATA/stics_executable/original/stics.exe",
                  obs_name = "Wheat_N0.obs",
                  Parameters= list(interrang= list(min=0.05, max=0.25),
                                   P_densitesem= list(min=140, max=280)),
                  Vars = c("raint", "lai(n)", "masec(n)"),
                  method= "fast99", n= 10,
                  q= "qunif",q.arg = list(list(min=0.05, max=0.25),
                  list(min=140, max=280)))

# Saving the output :

save_sensi(x = sens,dirpath = "3-Results/Sensitivity",
           width = 16,height = 9,units = "in")

sens= load_sensi(dirpath = "3-Results/Sensitivity")

## End(Not run)

VEZY/sticRs documentation built on Oct. 26, 2023, 7:37 a.m.