get_row_contamination_probability: Get probability of contamination of row

View source: R/gw-model.R

get_row_contamination_probabilityR Documentation

Get probability of contamination of row

Description

Get probability of contamination of row

Usage

get_row_contamination_probability(params_row)

Arguments

params_row

list or tibble row with appropriate names variables (see details)

Details

params_row must contain the following named variables:

  • z1, z2, rs, density, area must be units objects.

  • self_treat is a boolean

  • theta_range should be in radians as c(theta_min, theta_max)

  • alpha_range should be in radians as c(alpha_min, alpha_max)

  • hh_array_type character as "septic" or "well" (see get_septic_well_array)

Examples

## Not run: 
library(units)
params_row <- tibble(
  z1 = set_units(10, "ft"),
  z2 = set_units(20, "ft"),
  rs = set_units(15, "ft"),
  density = set_units(1, "1/acre"),
  area = set_units(64, "acre"),
  self_treat = TRUE,
  theta_range = list(c(0, pi/4)), # this will be unlisted in the function
  alpha_range = list(c(0, 20)), # this will be unlisted in the function
  hh_array_type = "septic")
get_row_contamination_probability(params_row)

# This function allows multiple rows to be calculated at once
params_df <- params_row %>% dplyr::select(-density, -rs, -self_treat) %>%
  tidyr::crossing(density = set_units(c(0, 1), "1/acre"),
  rs = set_units(c(10, 20),"ft"), self_treat = c(TRUE, FALSE))

# use sapply to get all probabilities at once
params_df$probs <- sapply(split(params_df, 1:nrow(params_df)), get_row_contamination_probability)
params_df

## End(Not run)

gopalpenny/nitratesgame documentation built on July 8, 2023, 6:10 p.m.