Description Usage Arguments Value Note Examples
generate JSON to aggregate (counting records, and, by default, averaging a given variable) within a collection
1 2 | makeAggregator(by = "chrom", vbl = "chromStart", opname = "average",
op = "$avg")
|
by |
character(1) telling the field for stratifying records for aggregation |
vbl |
character(1) telling field with numerical value for which a statistic will be computed within strata defined by 'by' |
opname |
character(1) define the name of the aggregation |
op |
character(1) evaluating to a mongo aggregation operator like '$avg' or '$min' |
a JSON document as produced by rjson::toJSON
This produces json that can be used as an argument to m$aggregate() for m a mongolite::mongo instance
1 2 3 4 5 6 7 8 9 10 11 12 | makeAggregator()
if (interactive() & verifyHasMongoCmd()) {
remURL = URL_txregInAWS()
colls = listAllCollections( url=remURL, db = 'txregnet')
m1 = mongo(url = remURL, db = 'txregnet',
collection='CD14_DS17215_hg19_FP')
# find minimum value of statistic 'stat' per chromosome
newagg = makeAggregator( by='chr',
vbl='stat', op='$min', opname='min')
tab = m1$aggregate( newagg )
head(tab)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.