1,359 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
2
answers
143
views
Rolling window across files
How do I a make a rolling window function that traverses multiple files in a directory such that the window can cross files?
I have a directory with multiple files in it. The files are named in ...
0
votes
0
answers
51
views
ACF/PACF for certain time-frame of time-series
I'm trying to analyse acf/pacf plots of industrial production index, using first and seasonal differences to correctly identify SARIMA parameters. Data are stored in "zoo" time-series object ...
2
votes
1
answer
110
views
Create rolling windows with custom overlap
I'd like to analyse time-series data along multiple rolling windows. As a first step, I'd like to extract the start and end-times of said windows. Sadly, using zoo:rollapply seems to be missing a ...
0
votes
1
answer
53
views
Why did I get the error: Error In File (file, "rt") Cannot Open the Connection when converting hourly to monthly data with zoo package?
so I pulled an hourly time series from a netcdf file and wanted to convert it to monthly data for some runs I'm doing. I keep getting the error in the title whenever I try to use the Zoo package to ...
0
votes
0
answers
50
views
R - Replacement Not Multiple Length Error for Zoo Object
I am trying to implement the VAR-based ConnectednessApproach R package, which requires a zoo object as an input. I have separate data frames that I merge together with an inner_join, which yields some ...
3
votes
5
answers
113
views
how to replace zero with incremental value in in R data frame?
I have a dataset where I want to replace each zero with incrementing values: the first zero becomes 0.001, the second 0.002, the third 0.003, and so on. Each time a zero appears, it should increase by ...
4
votes
2
answers
88
views
How to modify window width in rollapplyr() function based on column names in R
I have a data set that contains several variables of interest. What I'd like to do is compute a rolling average with the rollapplyr() function from the zoo package for each of them as additional ...
-1
votes
2
answers
59
views
Replace with 0 the first calculation in mutate and rollapply in R
i have a data frame in R called Data.
library(tibble)
library(dplyr)
library(zoo)
Data <- tibble(
var = c("A", "A", "A", "A", "A","A"),
...
1
vote
2
answers
53
views
How to repeat a column value based on a specific row value in R
I have the following data where I need to replace the values of UID column on the condition where the value will repeat until this specific value "Head of Household (Primary)" appears on the ...
0
votes
1
answer
74
views
Simple loop through large xts gives fatal error
I'm trying to add a variable that keeps track of the all-time high of a time series. The below code doesn't work - R encounters a fatal error during the for loop. I don't quite understand what's wrong ...
2
votes
3
answers
175
views
Interpolate dataframe in R subject to totals
I have the following dataset which has the number of A, B and C both in 2000 and 2005. I now need to inpolate the dataframe subject to the constraint that the sum of A, B and C must be consistent with ...
0
votes
1
answer
77
views
Creating a trailing rolling average without NAs at the beginning of the output
I'm working with a nested dataframe using dplyr. I need to mutate a second nested column with a copy of the data where all numeric columns are replaced with a trailing rolling average of the last 5 ...
0
votes
2
answers
118
views
rolling weighted mean by group with zoo and dplyr
I need to calculate the moving, weighted average by group in R.
Below is a sample of my code:
df %>%
arrange(Type, Year)
group_by(Type) %>%
mutate(
"weighted.rolling.mean" = ...
0
votes
1
answer
60
views
matrix with multiple sliding windows, an effective alternative zoo::rollapplyr()
I'm looking for an efficient solution (preferably C++) to replace this code:
m <- cbind(x1=1:10,x2=1:10,x3=1:10)
width=3
rol_m <- zoo::rollapplyr(m, width=width, c, fill=NA)
colnames(rol_m) <-...
1
vote
1
answer
55
views
Control the minimal number of required values when aggregating xts objects
When working with e.g. daily air temperature data, I'd like to have better control of how many observations are allowed to be missing in order to not calculate the monthly average (or whatever ...
dimfalk's user avatar
- 1,481