Displaying 8 results from an estimated 8 matches for "rollapplyr".
Did you mean:
rollapply
2012 Apr 05
1
is parallel computing possible for 'rollapplyr' job?
...,
The code below does exactly what I want in sequential mode. But, it is slow and I want to run it in parallel mode. I examined some windows version packages (parallel, snow, snowfall,..) but could not solve my specific problem. As far as I understood, either I have to write a new function like sfRollapplyr or I have to change my code in a way that it utilizes lapply, or sapply instead of 'rollapplyr' first then use sfInit, sfExport, and sfLapply,.. for parallel computing. I could not perform either so please help me :)
##
nc<-313
rs<-500000
ema<-10
h<-4
gomin1sd<-function (x,...
2017 Aug 10
3
Zoo rolling window with increasing window size
...lement, not necessarily sum()
I am looking for a generic solution for above problem.
Any better idea? Thanks,
On Fri, Aug 11, 2017 at 12:04 AM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
> Use a `width` of integer index locations. And you likely want =
> "right" (or rollapplyr(), as I used).
>
> R> set.seed(21)
> R> x <- rnorm(10)
> R> rs <- rollapplyr(x, seq_along(x), sum)
> R> cs <- cumsum(x)
> R> identical(rs, cs)
> [1] TRUE
>
>
> On Thu, Aug 10, 2017 at 1:28 PM, Christofer Bogaso
> <bogaso.christofer at gmai...
2017 Aug 10
0
Zoo rolling window with increasing window size
Replace "sum" with your custom function's name. I don't see any
reason why that wouldn't work, and the problem with my solution is not
clear in your response.
r <- rollapplyr(x, seq_along(x), yourCustomFunctionGoesHere)
On Thu, Aug 10, 2017 at 1:39 PM, Christofer Bogaso
<bogaso.christofer at gmail.com> wrote:
> Hi Joshua, thanks for your prompt reply. However as I said, sum()
> function I used here just for demonstrating the problem, I have other
> custo...
2017 Aug 10
0
Zoo rolling window with increasing window size
Use a `width` of integer index locations. And you likely want =
"right" (or rollapplyr(), as I used).
R> set.seed(21)
R> x <- rnorm(10)
R> rs <- rollapplyr(x, seq_along(x), sum)
R> cs <- cumsum(x)
R> identical(rs, cs)
[1] TRUE
On Thu, Aug 10, 2017 at 1:28 PM, Christofer Bogaso
<bogaso.christofer at gmail.com> wrote:
> Hi again,
>
> I am wonde...
2017 Aug 10
2
Zoo rolling window with increasing window size
Hi again,
I am wondering there is any function for 'zoo' time series, where I
can apply a user defined function rolling window basis, wherein window
size is ever increasing i.e. not fixed. For example, let say I have
below user defined function and a zoo time series :
> library(zoo)
> UDF = function(x) sum(x)
> TS = zoo(rnorm(10), seq(as.Date('2017-01-01'),
2018 Mar 25
3
Take average of previous weeks
Dear all,
I have weekly data by city (variable citycode). I would like to take the
average of the previous two, three, four weeks (without the current week)
of the variable called value.
This is what I have tried to compute the average of the two previous weeks;
df = df %>%
mutate(value.lag1 = lag(value, n = 1)) %>%
mutate(value .2.previous = rollapply(data = value.lag1,
2012 Apr 27
1
multivariate xts merge question
Hi,
I have an xts starting with a number of columns (currency pairs see below),
then I add new ones which are derived from existing ones (like adding the
moving average of a column) by merging the new columns one by one. These
get the name of the column they are calculated from concatenated with ".1".
All done by merge.xts, easy.
Now, I have a function (procState below) which generates
2012 Mar 25
2
avoiding for loops
I have data that looks like this:
> df1
group id
1 red A
2 red B
3 red C
4 blue D
5 blue E
6 blue F
I want a list of the groups containing vectors with the ids. I am
avoiding subset(), as it is
only recommended for interactive use. Here's what I have so far:
df1 <- data.frame(group=c("red", "red", "red", "blue",