Skip to contents

Given the dose as a column in a data.frame with a given molar concentration add a new column of the log base-10 dose, log_dose, in the data.frame and return it.

Usage

calculate_log_dose(data, dose_col = "dose", molar_concentration = 1)

Arguments

data

data.frame containing a column representing a dose in molar units.

dose_col

expression for dose column in the input data.frame (Default: "dose")

molar_concentration

numeric units of molar concentration of the dose column (Default: 1).

Value

input data.frame with an appended log_dose column which is the log10(<dose_col>) * molar_concentration.

Examples

if (FALSE) { # \dontrun{
# Consider observations at doses of 1 μM and 0.1 μM.
# If the doses are given in molar units (M) then
data <- data.frame(dose = c(1e-6, 1e-7)) |>
   BayesPharma::calculate_log_dose(dose_col = dose, molar_concentration = 1)
data$log_dose == c(-6, -7)

# If the doses are given with in units of nanomolar (nM) then
data <- data.frame(dose_nM = c(1000, 100)) |>
  BayesPharma::calculate_log_dose(
    dose_col = dose_nM,
    molar_concentration = 1e-9)
data$log_dose == c(-6, -7)
} # }