Description Usage Arguments Details Value Examples
Return a logical vector for filtering the table's rows following these steps:
Calculate summary values for the rows, either for the whole row or for each group;
Apply 'test' to the summarized values, comparing it to reference value(s) or using a custom function;
If test
was applied by group, reduce the logical result by
row-wise all
, any
or
count
.
1 2 3 4 |
x |
A matrix, data frame or data table. |
summary |
An expression with the summary method and the logical
comparison, or the name of a summary method. See Details. Defaults
to |
test |
A single character string representing a logical comparison, or
a funtion that will be called with the summary vector as the first argument.
Defaults to |
... |
A value to be compared to the summarized variables, or further
potential arguments passed to |
MoreArgs |
A list of arguments passed to |
method |
Method to obtain logical test results by row. Defaults to
|
group |
A <e2><80><98>factor<e2><80><99> in the sense that |
na.rm |
If |
drop |
Character vector of column names to be ignored. |
This function can be called in two different ways. The first and simpler one is using an expression:
filter_table(x, mean > 0) # TRUE if the row mean is greater than 0
The second, more flexible form, is using the individual parameters:
filter_table(x, summary='mean', test='>', 0) # argument names can be ommited
A logical vector indicating if each row passed the test.
1 2 3 4 5 6 7 8 9 10 11 12 | data(geneData, geneCovariate, package='Biobase')
gData <- head(geneData, n=100)
# Select if standard deviation of log expression level is greater than 0.5.
variant <- filter_table(log2(gData), sd > 0.5, na.rm=TRUE)
# Consider expressed if the median value is positive in at least one group.
expressed <- filter_table(gData, median > 0, method='any',
group=geneCovariate[c('sex', 'type')])
filtered <- gData[variant & expressed, ]
nrow(filtered)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.