Description Usage Arguments Value Author(s) See Also Examples
Functions for printing, subsetting and merging cohort objects.
1 2 3 4 5 6 7 8 9 10 11 |
x |
a cohort object |
object |
a cohort object |
y |
another cohort object |
subset |
expression denoting which rows to keep. It is interpreted within the environment of the cohort data.table, so columns can be referred to directly by name |
select |
vector of column names for columns to keep. The ID column is always selected. |
by |
character vector of column names to merge by. Defaults to the ID column of x. |
... |
additional arguments |
as.cohort
coerces its argument to a cohort if possible. If it is already a data.table, it is updated by reference, and the new name will be an alias to the existing object. Use copy = TRUE
explicitly to create a cohort object without altering the original object.
is.cohort
returns TRUE or FALSE according to whether the class of
the object is cohort
The summary
method displays the description table to the console.
The print
method displays the description table and the data itself, in the way that a data.table is displayed.
The subset
method returns a cohort object which contains a subset of the original cohort.
The merge
method returns a merged cohort containing x and y merged on the ID column.
Both cohort objects must have the same ID column, otherwise they cannot be merged.
Anoop Shah
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # data.table cohort
COHORT <- cohort(data.table(anonpatid = 1:3, indexdate = as.IDate(c("2012-1-3",
"2012-1-2", "2010-1-9"))))
COHORT2 <- cohort(data.table(anonpatid = 1:3, disease = c(TRUE, FALSE, TRUE)))
is.cohort(COHORT)
subset(COHORT, anonpatid == 2)
summary(COHORT)
merge(COHORT, COHORT2)
COHORT <- as.ffdf(COHORT)
COHORT2 <- as.ffdf(COHORT2)
is.cohort(COHORT)
subset(COHORT, as.ram(COHORT$anonpatid == 2))
merge(COHORT, COHORT2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.