View source: R/mean_Response.R
mean_Response | R Documentation |
Generate the mean response function for each stressor.
mean_Response(n.stressors = NA, str.list = NA, main = NA)
n.stressors |
Numeric. The number of stressors. |
str.list |
List object. A list object of dataframes of stressor response relationships. |
main |
Dataframe. A dataframe of the Main cover sheet for the stressor response relationships. |
Creates functions to interpolate the mean system capacity, SD, lower limit and upper limit.
## Not run:
library(JoeModelCE)
# Import of stressor response and magnitude workbook
filename_rm <- system.file("extdata", "stressor_magnitude_unc_ARTR.xlsx", package = "JoeModelCE")
filename_sr <- system.file("extdata", "stressor_response_fixed_ARTR.xlsx", package = "JoeModelCE")
dose <- StressorMagnitudeWorkbook(filename = filename_rm, scenario_worksheet = "natural_unc")
sr_wb_dat <- StressorResponseWorkbook(filename = filename_sr)
mean.resp.list <- mean_Response(
n.stressors = nrow(sr_wb_dat$main_sheet),
str.list = sr_wb_dat$sr_dat,
main = sr_wb_dat$main_sheet
)
# Get the mean response function for the first stressor
my_stressor <- sr_wb_dat$main_sheet$Stressors[[1]]
my_stressor
# Look at the stressor-response curve
sr_data <- sr_wb_dat$sr_dat[names(sr_wb_dat$sr_dat) == my_stressor][[1]]
plot(sr_data$value,
sr_data$mean_system_capacity,
type = 'b',
xlab = "Raw Stressor Value",
ylab = "Mean System Capacity (%)")
# The lookup the value from mean_Response()
custom_function <- mean.resp.list[[1]][[1]]
# Input several raw stressor values and the function will
# return the mean system capacity
custom_function(20)
custom_function(60)
custom_function(80)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.