similar to: Sliding a Window in R

Displaying 20 results from an estimated 10000 matches similar to: "Sliding a Window in R"

2012 Mar 03
1
Sliding Window in R (solved)
Dear all, you can find below my solution for sliding a window. Please find below the code for the two alternatives and the benchmarks.     install.packages('caTools') require(caTools) do_sliding_for_a_window_duty_cycle <- function(DataToAnalyse,  windowSize) {   data<-DataToAnalyse   out <- numeric()   elements<- numeric()   if (length(data[,1]) >= windowSize){       for
2008 Dec 16
8
sliding window over a large vector
Hi all, I have a very large binary vector, I wish to calculate the number of 1's over sliding windows. this is my very slow function slide<-function(seq,window){ n<-length(seq)-window tot<-c() tot[1]<-sum(seq[1:window]) for (i in 2:n) { tot[i]<- tot[i-1]-seq[i-1]+seq[i] } return(tot) } this works well for for reasonably sized vectors. Does
2008 Feb 13
4
rolling sum (like in Rmetrics package)
Hello, I'm new to R and would like to know how to create a vector of "rolling sums". (I have seen the Rmetrics package and the rollMean function and I would like to do the same thing except Sum instead of Mean.) I imagine someone has done this, I just can't find it anywhere. Example: x <- somevector #where x is 'n' entries long #what I would like to do is: x1
2012 Feb 21
2
In R 2.14.1, what does wrong sign in 'by' argument mean?
Here is my code slidingwindowplotATGC = function(windowsize, inputseq) { starts = seq(1, length(inputseq)-windowsize, by = windowsize) n = length(starts) chunkGs = numeric(n) chunkAs = numeric(n) chunkTs = numeric(n) chunkCs = numeric(n) for (i in 1:n) { chunk = windowsize[starts[i]:(starts[i]+9999)] chunkG = sum("g" ==
2012 Oct 16
2
sliding window analysis with rollapply
Dear List members I want to do the sliding window analysis of some specific values. Here is my code: require(zoo) dat <- read.table("chr1.txt", header = TRUE, sep="\t") dat2 <- cbind(dat[1,3]) #The first column is also important. It represents the position of the site on the chromosome. TS <- zoo(c(dat2)) a <- rollapply(TS, width=1000000, by=200000, FUN=mean,
2012 Sep 11
2
Sort or Permutate
Dear all, I am having a struct that contains on the first column file names and on the second column a number which is a "rating" of the file on first column A small subset looks like that small      [,1]                                                                                                                                                                 [1,]
2005 Jul 18
1
[PATCH] remove unused encoder buf in sb_celp.[hc]
diffed against http://svn.xiph.org/trunk/speex r9583 Index: libspeex/sb_celp.c =================================================================== --- libspeex/sb_celp.c (revision 9583) +++ libspeex/sb_celp.c (working copy) @@ -272,7 +272,6 @@ st->g0_mem=speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); st->g1_mem=speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); -
2011 Apr 04
1
moving mean and moving variance functions
Hello Lets say as an example I have a dataframe with the following attributes: rownum(1:405), colnum(1:287), year(2000:2009), daily(rownum x colnum x year) and foragePotential (0:1, by 0.01). The data is actually stored in a netcdf file and I'm trying to provide a conceptual version of the data. Ok. I need to calculate a moving mean and a moving variance for each cell on the following
2010 Jan 21
3
Na.omit on matrix, does the matrix have to have a limited size
Hello everyone, I am using the na.omit() function on a 785 x 79 matrix. When I restrict the matrix to 10 columns for example it returns me the right result with the na rows deleted: 756 x 10 matrix. But, if I enter the whole matrix it returns me a 64 x 79 matrix, ununderstandable, I have no idea why...Does anyone know what it could be? thanks -- View this message in context:
2012 Nov 22
1
Data Extraction - benchmark()
Hi Berend, I see you are one of the contributors to the rbecnhmark package. I am sorry that I am bothering you again. I have tried to run your code (slightly tweaked) involving the benchmark function, and I am getting the following error message. What am I doing wrong? Error in benchmark(d1 <- s1(df), d2 <- s2(df), d3 <- s3(df), d4 <- s4(df), : could not find function
2005 Apr 02
1
Survey of "moving window" statistical functions - still looking f or fast mad function
Hi, First, let me thank Jaroslaw for making this survey. I find it quite illuminating. Now the questions: * the #1 solution below (based on cumsum) is numerically unstable. Specifically if you do the runmean on a positive vector you can easily get negative numbers due to rounding errors. Does anyone see a modification which is free of this deficiency? * is it possible to optimize the
2003 May 25
0
Fitting an ARIMA model to a time series
R 1.6.2 on windows XP (and windows 2000) Dear Readers, I have to fit an ARIMA model to a blood pressure series to make predictions with it. But since I don't have a blood pressure data set yet I have to work with self made data. So I have created an AR( 2 ) series with the following code: series <- list() series$series <- arima.sim(n=2100, model=list(ar = c(0.6, 0.1)), sd=1) + 120
2012 Mar 24
2
Compare similarit of two vector of not same length
Dear all, this is not strictly R question. I have two vectors of different length (this is in the order of 10%). I am trying to see if still one can compare these two for similarity. IF the vectors were of the same length I would just take the difference of the two and plot a pdf of it. One way I am thinking is prorbably to find the longer length and short it in some way to get to the length of
2005 Nov 24
2
Source throttling bug, windows->linux
I'm getting a weird source throttling bug that I just don't know how to track down. Source is windows shoutcast 1.9.0 winamp plugin (XP up to date, and possibly others) Server is 2.3.0 It works fine for quite a while, then I get the following wierdness on tcpdump and it goes to hell: 21:03:54.601871 IP (tos 0x0, ttl 64, id 27852, offset 0, flags [DF], length: 40) server.8001 >
2013 Oct 29
1
TelosB external modules, guide
Hi all, I would like to ask your help regarding connecting external modules to telosb. I have found that tiny os offers many possibilities for that as ADC, GPIOs, SPI, UART, I2C I have never learned anything regarding those. Can someone please let me know if there is any simple guide on these "interfaces" to show with a primitive example how to start with? I would like to thank you
2012 Mar 24
2
expand.grid (the half!)
Dear all, I am using expand.grid for calculating all the possible values between four pairs. I would like to ask you if it is possible to filter the result out, so to keep all unique pairs. In my algorithm the input c(1,2) produces the same results as the c(2,1) so for example in the following code below > expand.grid(c(1,2,3),c(1,2,3))   Var1 Var2 1    1    1 2    2    1 3    3    1 4   
2012 May 10
2
How to capture NA values
Dear all, I would like to capture the NA values as produced from my code the str over the return values return int 61  int 65  int 69  int 73  int 101  int NA  int NA it looks like that I am getting returned some integer values that are NA and I want to have an if statement for catching those which is the right operator for checking these int NA values in R? Alex [[alternative HTML version
2009 Feb 26
3
Moving Average
I am looking for some help at removing low-frequency components from a signal, through Moving Average on a sliding window. I understand thiis is a smoothing procedure that I never done in my life before .. sigh. I searched R archives and found "rollmean", "MovingAverages {TTR}", "SymmetricMA". None of the above mantioned functions seems to accept the smoothing
2005 Oct 29
1
***SPAM*** pre-echo preventing
Hi! Dear all I compressed an audiu(wave) with libvorbis1.1.1 and found that the pre-echo was longer than the one which was compressed with MP3 at the same bitrate(128kbps),I am now confused aboout the pre-echo preventing scheme. Can you tell me what method does Ogg Vorbis adopt besides the auto windowsize switch? Looking forward to your letter! Thank you! ??????? Lisa (^_^)
2006 Jul 26
3
Moving Average
Dear R-Users, How can I compute simple moving averages from a time series in R? Note that I do not want to estimate a MA model, just compute the MA's given a lenght (as excel does). Thanks ________________________________________ Ricardo Gonçalves Silva, M. Sc. Apoio aos Processos de Modelagem Matemática Econometria & Inadimplência Serasa S.A. (11) - 6847-8889 ricardosilva@serasa.com.br