Description Usage Arguments Value Author(s) See Also Examples
View source: R/modifyDescription.R
Cohort objects (see cohort
) contain a description table as an attribute, which can be used to store column descriptions. purgeDescription
removes description entries for non-existent columns.
1 2 | modifyDescription(x, colname, description)
purgeDescription(x)
|
x |
a data.frame, ffdf, data.table or matrix object. |
colname |
vector of column names |
description |
vector of new descriptions |
Both functions invisibly return the modified object and update it by reference.
Anoop Shah
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | COHORT <- cohort(data.table(anonpatid = 1:3, indexdate = as.IDate(c("2012-1-3",
"2012-1-2", "2010-1-9"))))
modifyDescription(COHORT, 'indexdate', 'date when the patient presented')
modifyDescription(COHORT, 'another', 'a non-existent column')
summary(COHORT)
# Cohort with 3 patients.
# ID column: anonpatid
#
# COLUMN DESCRIPTIONS
# another (NULL): a non-existent column
# indexdate (IDate): date when the patient presented
# Warning message:
# In modifyDescription(COHORT, "another", "a non-existent column") :
# another not in cohort
purgeDescription(COHORT)
summary(COHORT)
# Cohort with 3 patients.
# ID column: anonpatid
#
# COLUMN DESCRIPTIONS
# indexdate (IDate): date when the patient presented
# Description for a matrix object
a <- matrix(1:4, nrow = 2, ncol = 2)
colnames(a) <- c('This', 'That')
a <- modifyDescription(a, 'This', 'This is the first column')
a <- modifyDescription(a, c('This', 'That'),
c('This is the first column', 'That is the second column'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.