| sliding.meansd {Ringo} | R Documentation |
This functions is used to slide a window of specified size over scores at given positions. Computed is the mean and standard deviation over the scores in the window.
sliding.meansd(positions, scores, half.width)
positions |
numeric; sorted vector of (genomic) positions of scores |
scores |
numeric; scores to be smoothed associated to the
positions |
half.width |
numeric, half the window size of the sliding window |
Matrix with three columns:
mean |
means over scores in running window centered at the
positions that were specified in argument positions. |
sd |
standard deviations over scores in running window centered
at the positions that were specified in argument positions. |
count |
number of points that were considered for computing the mean and standard deviation at each position |
Joern Toedling and Oleg Sklyar
set.seed(123)
sampleSize <- 10
ap <- cumsum(1+round(runif(sampleSize)*10))
as <- c(rnorm(floor(sampleSize/3)),
rnorm(ceiling(sampleSize/3),mean=1.5),
rnorm(floor(sampleSize/3)))
sliding.meansd(ap, as, 20)
ap
mean(as[1:3])
sd(as[1:3])