Add Covariate to IQRdataGENERAL object

New covariates specified in terms of data columns are added as columns to the data and as rows to the covInfo and catInfo tables. The function is also useful to add existing columns to the catInfo/covInfo table.

mutateCov_IQRdataGENERAL(data, ..., unit, name)



IQRdataGENERAL object.


specification of new covariates, e.g. STD = "STUDY" where STUDY is a column in data. More than one categorical covariate can be specified this way. Later covariates can make use of earlier covariates.


units of the covariates. Argument is recyled until its length is that of the list of new covariates.


description for the new covariate, e.g. "Study identifier".


IQRdataGeneral object


The characters provided by the dots argument are parsed and evaluated within data. New columns are appended to the original data. Depending on the columns used and the output of the evaluation (numeric or character), the new covariate is interpreted as continuous or categorical variable. The covInfo/catInfo table is modified to contain the new variable. However, the covariate is not introduced as a new set of rows with NAME equal to the name argument. For any new covariate it is checked if the covariate takes different values within one group defined by each USUBJID. IF that is the case, the covariate is marked as TIME.VARYING in the covInfo/catInfo table.

See also

Other IQRdataGeneral: +.IQRdataGENERAL(), IQRcalcTAD(), IQRdataGENERAL(), IQRexpandADDLII(), IQRloadCSVdata(), IQRsaveCSVdata(), 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(), 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()


if (FALSE) { # Add new continuous covariate test <- mutateCov_IQRdataGENERAL( dataGeneral, BMI = "WGT/HGT^2", unit = "kg/m^2", name = "Body mass index" ) # Do the same based on names instead of colnames test <- mutateCov_IQRdataGENERAL( dataGeneral, BMI = "Weight/Height^2", unit = "kg/m^2", name = "Body mass index" ) # Convert existing STUDY column into categorical covariate test <- mutateCov_IQRdataGENERAL( dataGeneral, STD = "STUDY", unit = NA, name = "Study identifier" ) # Create covariate based on general expressions test <- mutateCov_IQRdataGENERAL( dataGeneral, ASN = "ifelse(REG == 1, 'yes', 'no')", unit = NA, name = "Is Asian" ) # Do the same with names of the covariates test <- mutateCov_IQRdataGENERAL( dataGeneral, ASN = "ifelse(Region == 'Asia', 'yes', 'no')", unit = NA, name = "Is Asian" ) # If names contain spaces, use "." test <- mutateCov_IQRdataGENERAL( dataGeneral, EVM = "as.character( < 1)", unit = NA, name = "Early vomit" ) }