Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/createExternalCovariates.R
Create covariates by sampling from an external file.
1 2 3 4 | createExternalCovariates(subjects, names, file, sameRow = TRUE,
subset = NULL, refCol = NULL, dataId = idCol, idCol = getEctdColName("Subject"),
percent = 20, seed = .deriveFromMasterSeed(), includeIDCol = TRUE,
refColSuffix = "refCol", workingPath = getwd())
|
subjects |
(Required) Number of subjects for which to sample sets of external covariate values |
names |
(Required) Names of the covariates to use from the |
file |
(Required) Input file name. This should be either a valid csv file or a NONMEM
data file containing all the variables given by |
sameRow |
(Optional) A logical value). Should all the covariates be sampled from the
same rows or should the sampling be done independantly for each covariate. Using
|
subset |
(Optional) Any subset to be performed on the imported dataset before doing any
sampling. The subset is parsed by the |
refCol |
(Optional) The reference column in the data file. If given, the output
dataset will also contain an additional column indicating the origin of each row from the
original dataset. This option is not compatible with |
dataId |
(Optional) The subject variable in the input dataset, equal to |
idCol |
(Optional) The subject variable in the output dataset. "SUBJ" by default |
percent |
(Optional) When a subset is performed on the input data, if the number of
rows remaining in the dataset after subset is less than |
seed |
(Optional) Random generator seed to use. The current random seed is used by default |
includeIDCol |
(Optional) A logical value. Should the subject variable be included in
the output dataset? When |
refColSuffix |
(Optional) The suffix to use when creating the |
workingPath |
(Optional) Working path from which to import covariate file. By default, the current working directory is used |
The sampling is always done with replacement.
The refCol
setting is typically used with the parameter component,
see createParameters
or createExternalParameters
to
maintain consistency between imported covariates and imported parameters.
A data frame containing the imported variables, and possibly a reference variable.
Mike K Smith mstoolkit@googlemail.com
createContinuousCovariates
,
createDiscreteCovariates
, and
createCovariates
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
# an example file from the unit tests of the MSToolkit package
wPath <- system.file( "Runit", "data", "createCovariates", package = "MSToolkit" )
# sample 20 subjects from the example file
dat <- createExternalCovariates( 20, names = "X1",
subset = c(".7 < X1 < .8", "-1 <= X2 <= 1"),
file = "testCovariates.csv", workingPath = wPath )
print( dat )
# maintaining the origin of each row
dat <- createExternalCovariates( 20, names = "X1, X2",
subset = c(".7 < X1 < .8", "-1 <= X2 <= 1"),
file = "testCovariates.csv", workingPath = wPath, refCol = "ID" )
print( dat )
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.