Description Usage Arguments Details Value Author(s) Examples

This is a parallel version of `aggregate`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
## S4 method for signature 'formula,BiocParallelParam'
bpaggregate(x, data, FUN, ...,
BPREDO=list(), BPPARAM=bpparam())
## S4 method for signature 'data.frame,BiocParallelParam'
bpaggregate(x, by, FUN, ...,
simplify=TRUE, BPREDO=list(), BPPARAM=bpparam())
## S4 method for signature 'matrix,BiocParallelParam'
bpaggregate(x, by, FUN, ...,
simplify=TRUE, BPREDO=list(), BPPARAM=bpparam())
## S4 method for signature 'ANY,missing'
bpaggregate(x, ..., BPREDO=list(), BPPARAM=bpparam())
``` |

`x` |
A |

`by` |
A list of factors by which |

`data` |
A |

`FUN` |
Function to apply. |

`...` |
Additional arguments for |

`simplify` |
If set to |

`BPPARAM` |
An optional |

`BPREDO` |
A |

`bpaggregate`

is a generic with methods for `data.frame`

`matrix`

and `formula`

objects. `x`

is divided
into subsets according to factors in `by`

. Data chunks are
sent to the workers, `FUN`

is applied and results are returned
as a `data.frame`

.

The function is similar in spirit to `aggregate`

from the stats package but `aggregate`

is not
explicitly called. The `bpaggregate`

`formula`

method
reformulates the call and dispatches to the `data.frame`

method
which in turn distributes data chunks to workers with `bplapply`

.

See `aggregate`

.

Martin Morgan mailto:mtmorgan@fhcrc.org.

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
if (interactive() && require(Rsamtools) && require(GenomicAlignments)) {
fl <- system.file("extdata", "ex1.bam", package="Rsamtools")
param <- ScanBamParam(what = c("flag", "mapq"))
gal <- readGAlignments(fl, param=param)
## Report the mean map quality by range cutoff:
cutoff <- rep(0, length(gal))
cutoff[start(gal) > 1000 & start(gal) < 1500] <- 1
cutoff[start(gal) > 1500] <- 2
bpaggregate(as.data.frame(mcols(gal)$mapq), list(cutoff = cutoff), mean)
}
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.