shrink_matrix | R Documentation |
Shrink a numeric matrix across groups of rows, by applying a summary function.
shrink_matrix(
x,
groupBy,
shrink_func = function(x) {
mean(x, na.rm = TRUE)
},
return_class = c("data.frame", "matrix"),
verbose = FALSE,
...
)
x |
|
groupBy |
|
shrink_func |
|
return_class |
|
verbose |
logical indicating whether to print verbose output. |
This function is mainly a wrapper to use the amazingly fast
data.table
package, with the ability to
provide a custom function to shrink row values.
The default function uses mean(x, na.rm=TRUE)
so that NA
values are ignored where possible.
This function applies the same shrink_func
to all columns, and
it optimal for numeric
values. For more control over which
function to apply to specific columns, see shrinkDataFrame()
.
Trivia:
This function is identical to splicejam::shrinkDataFrame()
except
that the default shrink_func
includes na.rm=TRUE
and no
longer calls the .Internal()
function, since that is not
permitted by CRAN package guidelines.
data.frame
or matrix
based upon argument return_class
.
Other jamses utilities:
choose_annotation_colnames()
,
contrast2comp_dev()
,
fold_to_log2fold()
,
intercalate()
,
list2im_opt()
,
log2fold_to_fold()
,
make_block_arrow_polygon()
,
mark_stat_hits()
,
matrix_normalize()
,
point_handedness()
,
point_slope_intercept()
,
shortest_unique_abbreviation()
,
shrinkDataFrame()
,
shrink_df()
,
sort_samples()
,
strsplitOrdered()
,
sub_split_vector()
,
update_function_params()
,
update_list_elements()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.