dilution <- function(c1 = NULL,
v1 = NULL,
c2 = NULL,
v2 = NULL
) {
IN <- list(
"c1" = c1,
"v1" = v1,
"c2" = c2,
"v2" = v2
)
check_null <- lapply(IN, is.numeric)
check <- sum(!unlist(check_null))
if (check != 1) {
message("3 numeric inputs of c1,v1,c2,v2 required")
return(NULL)
}
is_null <- names(IN[!unlist(check_null)])
list("c1" = c2 * v2 * (v1 ^ -1),
"v1" = c2 * v2 * (c1 ^ -1),
"c2" = c1 * v1 * (v2 ^ -1),
"v2" = c1 * v1 * (c2 ^ -1))[[is_null]]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.