Description Usage Arguments Details Value Examples
A version of the setnames
data.table function for ffdf data frames or cohort
objects.
1 2 3 4 5 6 7 |
x |
A data.table, cohort or ffdf object |
old |
Old column names or positions, or a vector of all new column names if |
new |
New column names |
Defines 'setnames' as a generic function. For data.table objects, it
dispatches the setnames
method in the data.table package.
For cohort objects, it also updates the description table and idcolname.
For FFDF objects, the object is not modified by reference but the modified
object is returned.
Invisibly returns the modified object. If it is a data.table, it is also updated by reference.
1 2 3 4 5 6 7 8 9 10 11 12 | COHORT <- cohort(data.table(anonpatid = 1:3, indexdate = as.IDate(c("2012-1-3",
"2012-1-2", "2010-1-9"))))
FFDFCOHORT <- as.ffdf(COHORT)
# Data table cohort does not need assignment for changing names
print(COHORT)
setnames(COHORT, c('anonpatid', 'indexdate'), c('id', 'startdate'))
print(COHORT)
print(FFDFCOHORT)
FFDFCOHORT <- setnames(FFDFCOHORT, c('anonpatid', 'indexdate'), c('id', 'startdate'))
print(FFDFCOHORT)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.