Questions tagged [tibbletime]
20 questions
4
votes
0 answers
Anomalize Package in R -> Error in mutate_impl(.data, dots)
After looking at all the related post, I have yet to find an acceptable working solution. Thus, I decided to try and ask again!
Error in mutate_impl(.data, dots) : Evaluation error: Only year, quarter, month, week, and day periods are allowed for an…

Sun
- 49
- 4
2
votes
3 answers
How to deduplicate date sequences across non-consecutive rows in R?
I want to flag the first date in every window of at least 31 days for each id in my data.
Data:
library(tidyverse)
library(lubridate)
library(tibbletime)
D1 <- tibble(id = c(12,12,12,12,12,12,10,10,10,10),
…

Ezra
- 21
- 4
2
votes
2 answers
How to create a time series with tibbletime with parameterized dates?
I want to create a time series with tibbletime for specific dates.
I have:
Data_Start<-"2015-09-07 01:55:00 UTC"
Data_End<-"2015-09-10 01:59:00 UTC"
and I want to create a timeseries, with minute samples, like with:
create_series(2015-09-07 +…

schmitzi89
- 47
- 7
1
vote
0 answers
Looping through possible time periods
I am trying to export into a new dataframe the number of days within a 16 day time period where temperatures exceed 22.3.
I want to complete this for all of the possible 16 day periods within June-August (ie 1st June-16th June, 2nd June-17th June…

Ellie Rose
- 23
- 3
1
vote
2 answers
Using the last day in each month of my time series in R
I need to use only the last day available in my dataset to aggregate later on but I didn´t have success...
library(tibbletime)
dataset <- data.frame(
timestamp = c("2010-01-01", "2010-01-03", "2010-01-23")
var = c( 1, 4,…

Rodrigo H. Ozon
- 125
- 7
1
vote
1 answer
Rolling sum within group boundaries
I'm trying to calculate a rolling sum based on the following toydata:
structure(list(Tag = c("1", "1", "1", "1", "2", "2", "2", "2", "2",
"2"), ID = c("A", "A", "A", "B", "J", "J", "J", "A", "A", "A" ),
correctvis = c(1, 0, 1, 1, 1, 0, 1, 0, 1,…

R. Iersel
- 89
- 9
1
vote
1 answer
Grouped tibbletime and using collapse_index, getting weird results
I have a file (appx 9K records) that I want to aggregate based on the group first, and then on dates that are within seven days of each other. However, I'm not understanding why the results look the way they do. I realize there are other ways I…

kpress
- 136
- 6
0
votes
1 answer
Error with calculating rolling z score using rollify in R
I have the following dataframe in R. I'm trying to calculate a 5 day rolling Z score (X minus its rolling mean, divided by its rolling standard deviation) by creating a function for this using…

Tanga94
- 695
- 6
- 27
0
votes
2 answers
rollify function in R
I have the following script in R
library(tidyverse)
library(lubridate)
library(tibbletime)
payments <- read_csv("payments.csv")
monthly_sum_df <- payments %>%
group_by(year(Date), month(Date)) %>%
summarize(monthly_sum = sum(Amount, na.rm =…

Norhther
- 545
- 3
- 15
- 35
0
votes
1 answer
Calculating rolling Beta
I'm trying to generate rolling betas for stocks and my rolling function is not working. What I have tried so far:
library(tidyquant)
library(tidyverse)
library(tibbletime)
ticker_data <- tq_get(c("AAPL", "SPY"))
daily_returns <- ticker_data %>%
…

cephalopod
- 1,826
- 22
- 31
0
votes
1 answer
Transformation of daily prices in monthly log returns
I'm trying to replicate a code from a book, "Reproducible Finance with R". All went quite good except for the following part.
asset_returns_tbltime <-
prices %>%
tk_tbl(preserve_index = TRUE,
rename_index = "date") %>%
as_tbl_time(index = date)…

dkolkin
- 81
- 10
0
votes
1 answer
Create a multi-facets plot with common shaded rectangle (geom_rect)
I do apologise in advance but I'm not an R expert (at all). I used R rarely and the last time, I had to convert my data as tibble in order to plot them correctly, and now I did the same but I believe it would be better to convert them into POSIXct…

Simone Aveni
- 5
- 3
0
votes
1 answer
tibbletime with tq_transmute producing strange error, column obviously exists but says it doesn't
I could have sworn this code worked a week ago, but I guess that I am mistaken. I keep getting the error: Error: Can't subset columns that don't exist.
x Column asset doesn't exist.
Run rlang::last_error() to see where the error occurred.
In…
user12679253
0
votes
0 answers
Error faced while trying to do anomaly detection with R
I'm trying to use R Anomalize package to check the anomalies in our revenue,
I'm following the instructions from Quick start documentation below,
https://cran.r-project.org/web/packages/anomalize/vignettes/anomalize_quick_start_guide.html
In my…
0
votes
1 answer
dplyr and tibbletime. Object is not of class 'til_time'. And general approach to time aggregation
I am new to packages dplyr and tibbletime and have the following objective. I need to sum the quantities of trades (qty in a dataset) that occur in the same interval of 24 hours. For instance, I have 3 trades within 1 hour with 300, 200 and 100…

Grigory
- 7
- 2