Get probabilities of contamination

get_contamination_probabilities(params_df, show_progress = FALSE)

Arguments

params_df

tibble with appropriate columns (see details)

show_progress

boolean, whether or not to show progress bar

Details

params_df must contain the following named columns:

  • 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

#> udunits system database from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/units/share/udunits
library(tidyr) params_row <- tibble( z1 = set_units(10, "ft"), z2 = set_units(20, "ft"), area = set_units(64, "acre"), 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") # This function allows multiple rows to be calculated at once params_df <- params_row %>% crossing(density = set_units(c(0, 0.5), "1/acre"), rs = set_units(c(10, 20),"ft"), self_treat = c(TRUE, FALSE)) params_df$probs <- get_contamination_probabilities(params_df) params_df
#> # A tibble: 8 x 10 #> z1 z2 area theta_range alpha_range hh_array_type density #> [ft] [ft] [acre] <list> <list> <chr> [1/acre] #> 1 10 20 64 <dbl [2]> <dbl [2]> septic 0.0 #> 2 10 20 64 <dbl [2]> <dbl [2]> septic 0.0 #> 3 10 20 64 <dbl [2]> <dbl [2]> septic 0.0 #> 4 10 20 64 <dbl [2]> <dbl [2]> septic 0.0 #> 5 10 20 64 <dbl [2]> <dbl [2]> septic 0.5 #> 6 10 20 64 <dbl [2]> <dbl [2]> septic 0.5 #> 7 10 20 64 <dbl [2]> <dbl [2]> septic 0.5 #> 8 10 20 64 <dbl [2]> <dbl [2]> septic 0.5 #> # … with 3 more variables: rs [ft], self_treat <lgl>, probs <dbl>