Plot observations along with summaries for each covariate

Continuous covariates are categorized into quartiles before plotting.

plotObsSummarizedByCovCat_IQRdataGENERAL(
  data,
  filename = NULL,
  covNames = NULL,
  FLAGlogY = TRUE,
  FLAGuseTAD = FALSE,
  FLAGplotBins = FALSE,
  stratifyBy = NULL,
  periodBy = NULL,
  BIN.column = NULL,
  BIN.breaks = NULL,
  BIN.groupsize = NULL,
  BIN.lambda = 1,
  BIN.resolution = 0.1,
  percentiles = c(50),
  FLAGaddSummaryNotByColor = TRUE,
  ...
)

Arguments

data

Only IQRdataGENERAL or IQRnlmeDATA allowed.

filename

The file name where the output PDF will be saved. If NULL, no plot is saved to file.

covNames

A character vector specifying the names of continuous and/or categorical covariates of interest. If NULL, all categorical and continuous covariates are selected and plotted.

FLAGlogY

logical. If TRUE the Y axis will be shown in logscale.

FLAGuseTAD

logical. If TRUE then observed time after previous dose (TAD) is used for x-axis. If FALSE then actual TIME is used.

FLAGplotBins

Flag whether to plot the bin boundaries as vertical lines

stratifyBy

Column name used to stratify VPC plots

periodBy

Colum name identifying different periods (time-varying categorical covariates) Time courses are binned and plotted separately. Whether they are plotted in the same panel is set by FLAGstratifyByPeriod

BIN.column

Column name of integer column assigning the observations to time bins. Defaults to NULL such that bins are automatically generated or the user-provided BIN.breaks are used.

BIN.breaks

Numerical vector with bin borders that are used for the observation times. Defaults to NULL such that bins are automatically generated. This input is ignored if BIN.column is provided.

BIN.groupsize

Smallest expected group size for the binning. By default the round(0.5 x number of subjects) in the dataset is used.

BIN.lambda

Penalization of intra-group variance, set to 1 to have more groups and set to 0 to get less but larger groups.

BIN.resolution

Gaps between groups of data points greater than resolution lead to separation of groups

percentiles

numeric vector with 1, 2 or 3 entries between 0 and 100 to be used as percentiles for data and simulation plots. 1 entry: only this percentile is plotted, e.g. for 50 the median is visualized. 2 entries: low, and high percentiles were provided and median should also be plotted. 3 entries: low, medium and high percentiles were provided in this order.

FLAGaddSummaryNotByColor

Add an "Overall" summary in addition to the stratification by colorBy

...

Arguments going to IQRoutputFigure().

Value

A list of ggplot objects if filename is NULL, otherwise the function saves the plot to filename. The list is ordered hierarchically by output, covariate, and stratifyBy

See also

plotVPC_IQRdataVPC()

Other IQRdataGeneral: +.IQRdataGENERAL(), IQRcalcTAD(), IQRdataGENERAL(), IQRexpandADDLII(), IQRloadCSVdata(), IQRsaveCSVdata(), addCovariateInfo_IQRdataGENERAL(), addIndivRegressors_IQRdataGENERAL(), addLabel_IQRdataGENERAL(), attributes0(), blloqInfo_IQRdataGENERAL(), blloq_IQRdataGENERAL(), check_IQRdataGENERAL(), clean_IQRdataGENERAL(), combine_IQRdataGENERAL(), convertCat2Text(), covImpute_IQRdataGENERAL(), date2dateday_IQRdataProgramming(), date2datetime_IQRdataProgramming(), date2time_IQRdataProgramming(), exportDEFINE_IQRaedataER(), exportDEFINE_IQRdataGENERAL(), exportDEFINEpdf_IQRdataGENERAL(), exportSYS_IQRdataGENERAL(), export_IQRdataGENERAL(), getLabels_dataframe(), getNAcolNLME_IQRdataGENERAL(), handleSameTimeObs_IQRdataGENERAL(), is_IQRdataGENERAL(), loadATRinfo_csvData(), loadAttributeFile(), load_IQRdataGENERAL(), mapCategoricalCovariate_IQRnlmeProject(), mapCategoricalCovariate_csvData(), mapContinuousCovariate_IQRnlmeProject(), mapContinuousCovariate_csvData(), mutateCov_IQRdataGENERAL(), obfuscate_IQRdataGENERAL(), plot.IQRdataGENERAL(), plotCorCat_IQRdataGENERAL(), plotCorCovCat_IQRdataGENERAL(), plotCorCov_IQRdataGENERAL(), plotCovDistribution_IQRdataGENERAL(), plotDoseSchedule_IQRdataGENERAL(), plotIndiv_IQRdataGENERAL(), plotRange_IQRdataGENERAL(), plotSampleSchedule_IQRdataGENERAL(), plotSpaghetti_IQRdataGENERAL(), print.IQRdataGENERAL(), removeCommata_dataframe(), rmAMT0_IQRdataGENERAL(), rmDosePostLastObs_IQRdataGENERAL(), rmIGNOREd_IQRdataGENERAL(), rmMissingTIMEobsRecords_IQRdataGENERAL(), rmNOobsSUB_IQRdataGENERAL(), rmNonTask_IQRdataGENERAL(), rmPLACEBO_IQRdataGENERAL(), rmSubjects_IQRdataGENERAL(), setIGNORErecords_IQRdataGENERAL(), setMissingDVobsRecordsIGNORE_IQRdataGENERAL(), subset.IQRdataGENERAL(), summary.IQRdataGENERAL(), summaryCat_IQRdataGENERAL(), summaryCov_IQRdataGENERAL(), summaryObservations_IQRdataGENERAL(), transformObs_IQRdataGENERAL(), unlabel_dataframe()

Author

Sebastian Blachuta, Intiquan AG

Examples

if (FALSE) { # \dontrun{
# Load data
temp_gdf <- load_IQRdataGENERAL(system.file("examples/NLMEProjects/Webinar/02-Data/dataPKPD/dataNLME.csv", package = "IQRtools"))
temp_gdf <- subset(temp_gdf, TIME <= 24)
filename <- "plotObsSummarizedByCovCat.pdf"

# Example 1.1
## Plot only summary of SEX covariate
plotObsSummarizedByCovCat_IQRdataGENERAL(data = temp_gdf, covNames = "SEX", filename = filename)

# Example 1.2
## Plot only summary of weight (WT0) with quartile information.
## Stratification by SEX: One plot per SEX is outputted.
plotObsSummarizedByCovCat_IQRdataGENERAL(data = temp_gdf, covNames = "WT0", stratifyBy = "SEX", filename = filename)

# Example 1.2
## Plot only summary of weight (WT0) with quartile information.
## Stratification by SEX: One plot per SEX is outputed.
## Percentiles are plotted as dotted lines.
plotObsSummarizedByCovCat_IQRdataGENERAL(data = temp_gdf, covNames = "WT0", stratifyBy = "SEX", percentiles = c(5, 95), filename = filename)

# Example 1.4
## Plot all covariate summary.
## Use ncores for parallel outputting to speed up file generation.
plotObsSummarizedByCovCat_IQRdataGENERAL(data = temp_gdf, covNames = NULL, filename = filename, opt.pagesize = opt.pagesize(scale = 1.3), ncores = 6)

# Clean up
unlink(filename)
unlink(paste0(filename, ".log"))
} # }