Description Usage Arguments Value See Also Examples
Extract row-subset of a data.frame
according to a condition. If any cases (rows) are omitted, they are listed with a warning. Rows where the condition gives NA are omitted.
1 2 3 4 5 | # This is the obligatory format, and is not very useful; look at EXAMPLES instead
warn.and.subset(x, cond,
mess.head=deparse( substitute( x), width.cutoff=20, control=NULL, nlines=1),
mess.cond=deparse( substitute( cond), width.cutoff=40, control=NULL, nlines=1),
row.info=rownames( x), sub=TRUE)
|
x |
data.frame |
cond |
expression to evaluate in the context of |
mess.head |
description of data.frame (e.g. its name) for use in a warning. |
mess.cond |
description of the desired condition for use in a warning. |
row.info |
character vector that will describe rows; omitted elements appear in the warning |
sub |
should |
# ...: just there to keep RCMD CHECK happy– for heaven's sake...
The subsetted data.frame.
%where.warn%
which is a less-flexible way of doing the same thing
1 2 3 4 | df <- data.frame( a=1:3, b=letters[1:3])
df1 <- warn.and.subset( df, a %% 2 == 1, 'Boring example data.frame', 'even-valued "a"')
condo <- quote( a %% 2 == 1)
df2 <- warn.and.subset( df, condo, 'Same boring data.frame', deparse( condo), sub=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.