lambda_slope_plot.Rd
This function generates a lambda slope plot using pharmacokinetic data. It calculates relevant lambda parameters and visualizes the data points used for lambda calculation, along with a linear regression line and additional plot annotations.
lambda_slope_plot(
res_pknca_df = myres$result,
conc_pknca_df = mydata$conc$data,
dosno = profile,
usubjid = patient,
R2ADJTHRESHOL = 0.7
)
Data frame containing the results of the pharmacokinetic non-compartmental
analysis (default is PKNCA::pk.nca(.)$result
).
Data frame containing the concentration data
(default is mydata$conc$data
).
Numeric value representing the dose number (default is profile
).
Character value representing the unique subject identifier
(default is patient
).
Numeric value representing the R-squared adjusted threshold for determining the subtitle color (default is 0.7).
A plotly object representing the lambda slope plot.
The function performs the following steps:
Filters and arranges the input data to obtain relevant lambda calculation information.
Identifies the data points used for lambda calculation.
Calculates the fitness, intercept, and time span of the half-life estimate.
Determines the subtitle color based on the R-squared adjusted value and half-life estimate.
Generates a ggplot object with the relevant data points, linear regression line, and annotations.
Converts the ggplot object to a plotly object for interactive visualization.
if (FALSE) { # \dontrun{
# Example usage:
plot <- lambda_slope_plot(res_pknca_df = myres$result,
conc_pknca_df = mydata$conc$data,
dosno = 1,
usubjid = "subject_1",
R2ADJTHRESHOL = 0.7)
plot
} # }