Calculate Matrix Ratios This function calculates the ratios for a given data set, based on the shared time points for each matrix concentration sample. The user can input multiple tissues for which ratios should be calculated.
Source:R/ratio_calculations.R
multiple_matrix_ratios.Rd
The ratios are calculated as specimen1 / specimen 2.
Usage
multiple_matrix_ratios(
data,
matrix_col,
conc_col,
units_col,
groups = c("TIME", "USUBJID"),
spec1,
spec2
)
Arguments
- data
A data frame containing the concentration data.
- matrix_col
A character string specifying the column name for the matrix type.
- conc_col
A character string specifying the column name for the concentration data.
- units_col
A character string specifying the column name for the units.
- groups
A character vector of grouping variables to use for the analysis. Must include TIME, USUBJID, and optionally, other grouping variables.
- spec1
A character string specifying the value for the first specimen type(s) in the matrix_col.
- spec2
A character string specifying the value for the second specimen type(s) in the matrix_col.
Examples
data <- data.frame(
USUBJID = c("A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A"),
TIME = c(0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2),
MATRIX = c("BLOOD", "BLOOD", "BLOOD", "PLASMA", "PLASMA", "PLASMA",
"BRAIN", "BRAIN", "BRAIN", "LIVER", "LIVER", "LIVER"),
CONC = c(10, 20, 15, 25, 30, 40, 5, 10, 8, 12, 18, 16),
UNITS = rep("ng/mL", 12)
)
multiple_matrix_ratios(data, "MATRIX", "CONC", "UNITS", c("TIME", "USUBJID"), "BLOOD", "PLASMA")
#> # A tibble: 3 × 7
#> # Rowwise:
#> TIME USUBJID Ratio_Type Spec1_Value Spec2_Value Ratio Unit
#> <dbl> <chr> <chr> <dbl> <dbl> [1] <chr>
#> 1 0 A BLOOD/PLASMA 10 25 0.4 unitless
#> 2 1 A BLOOD/PLASMA 20 30 0.667 unitless
#> 3 2 A BLOOD/PLASMA 15 40 0.375 unitless