Description Usage Arguments Details Value Author(s) Examples
Reduce the size of a numeric vector (typically large) to a more compact one by averaging the numeric values of 'binSize' (constant) consecutive cells.
1 | binVector(piledValues, binSize)
|
piledValues |
A numeric vector |
binSize |
Size of the bins |
This function is typically used to represent piling scores for large chromosomes, specially if the scores have to be written in a file (WIG fixed step). When the last bin has fewer number of items, an average is also computed but only on the items available.
A numeric vector filled by the C function
Romain Fenouil
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Create a vector of values and plot it
myValues <- sin(seq(1,10, length.out=300))*10
plot(x=1:length(myValues), myValues, type="b", pch=".", cex=2)
# Bin the vector by chunks of 20 points (compute the average value)
binnedValues <- binVector(myValues,20)
# Plot the binned value on top (with centered coordinates)
points(((x=1:length(binnedValues))*20)-10,
y=binnedValues,
col="blue",
type="b",
pch=5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.