Description Usage Arguments Value See Also Examples
View source: R/meanInRegions.R
Returns the mean of a value defined by a region set over another set of regions.
1 | meanInRegions(A, x, col.name=NULL, ...)
|
A |
a region set in any of the accepted formats by |
x |
a region set in any of the accepted formats with an additional column with a value associated to every region. Regions in |
col.name |
character indicating the name of the column. If NULL and if a column with the name "value" exist, it will be used. The 4th column will be used otherwise (or the 5th if 4th is the strand). |
... |
any additional parameter needed |
It returns a numeric value that is the weighted mean of "value" defined in x
over the regions in A
. That is, the mean of the value of all
regions in x
overlapping each region in A
weighted according to the number of bases overlapping.
1 2 3 4 5 6 7 8 9 10 11 12 | A <- data.frame("chr1", c(1, 10, 20, 30), c(12, 13, 28, 40))
positions <- sample(1:40,30)
x <- data.frame("chr1", positions, positions, rnorm(30,4,1))
meanInRegions(A, x)
x <- GRanges(seqnames=x[,1],ranges=IRanges(x[,2],end=x[,2]),mcols=x[,3])
meanInRegions(A, x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.