Description Usage Arguments Details See Also Examples

The S4Vectors package defines `aggregate`

methods
for Vector, Rle, and List objects.

1 2 3 4 5 6 7 8 9 10 11 | ```
## S4 method for signature 'Vector'
aggregate(x, by, FUN, start=NULL, end=NULL, width=NULL,
frequency=NULL, delta=NULL, ..., simplify=TRUE)
## S4 method for signature 'Rle'
aggregate(x, by, FUN, start=NULL, end=NULL, width=NULL,
frequency=NULL, delta=NULL, ..., simplify=TRUE)
## S4 method for signature 'List'
aggregate(x, by, FUN, start=NULL, end=NULL, width=NULL,
frequency=NULL, delta=NULL, ..., simplify=TRUE)
``` |

`x` |
A Vector, Rle, or List object. |

`by` |
An object with If |

`FUN` |
The function, found via |

`start, end, width` |
The start, end, and width of the subsets. If |

`frequency, delta` |
Optional arguments that specify the sampling frequency and increment
within the subsets (in the same fashion as |

`...` |
Optional arguments to |

`simplify` |
A logical value specifying whether the result should be simplified to a vector or matrix if possible. |

Subsets of `x`

can be specified either via the `by`

argument
or via the `start`

, `end`

, `width`

, `frequency`

, and
`delta`

arguments.

For example, if `start`

and `end`

are specified, then:

1 |

is equivalent to:

1 2 |

(replace `x[start[i]:end[i]]`

with 2D-style subsetting
`x[start[i]:end[i], ]`

if `x`

is a DataFrame object).

The

`aggregate`

function in the stats package.-
Vector, Rle, List, and DataFrame objects.

The

`start`

,`end`

, and`width`

generic functions defined in the BiocGenerics package.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
x <- Rle(10:2, 1:9)
aggregate(x, x > 4, mean)
aggregate(x, FUN=mean, start=1:26, width=20)
## Note that aggregate() works on a DataFrame object the same way it
## works on an ordinary data frame:
aggregate(DataFrame(state.x77), list(Region=state.region), mean)
aggregate(weight ~ feed, data=DataFrame(chickwts), mean)
library(IRanges)
by <- IRanges(start=1:26, width=20, names=LETTERS)
aggregate(x, by, is.unsorted)
``` |

Bioconductor/S4Vectors documentation built on Dec. 11, 2019, 6:55 a.m.

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.