This function generates a line plot for an ADNCA dataset based on user-selected analytes, subjects, and other parameters. The plot can be customized to display data on a linear or logarithmic scale and can be filtered by cycle.

general_lineplot(
  data,
  selected_analytes,
  selected_usubjids,
  colorby_var,
  time_scale,
  xaxis_scale,
  cycle = NULL
)

Arguments

data

A data frame containing the ADNCA dataset.

selected_analytes

A character vector of selected analytes to be included in the plot.

selected_usubjids

A character vector of selected unique subject identifiers (USUBJIDs) to be included in the plot.

colorby_var

A character string specifying the variable by which to color the lines in the plot.

time_scale

A character string specifying the time scale. Options are "By Cycle" or other values.

xaxis_scale

A character string specifying the x-axis scale. Options are "Log" or other values.

cycle

A character string or numeric value specifying the cycle to filter by when time_scale is "By Cycle". Default is NULL.

Value

A ggplot object representing the line plot of pharmacokinetic concentration over time.

Details

The function performs the following steps:a

  • Filters the data based on the selected analytes and subjects.

  • Selects relevant columns and removes rows with missing concentration values.

  • Converts 'USUBJID', 'DOSNO', and 'DOSEA' to factors.

  • Filters the data by cycle if time_scale is "By Cycle".

  • Adjusts concentration values for logarithmic scale if xaxis_scale is "Log".

  • Generates a line plot using the g_ipp function with the specified parameters.

  • Adjusts the y-axis to logarithmic scale if xaxis_scale is "Log".

Examples

if (FALSE) { # \dontrun{
  # Example usage:
  plot <- general_lineplot(data = adnca_data,
                           selected_analytes = c("Analyte1", "Analyte2"),
                           selected_usubjids = c("Subject1", "Subject2"),
                           colorby_var = "DOSNO",
                           time_scale = "By Cycle",
                           xaxis_scale = "Log",
                           cycle = "1")
  print(plot)
} # }