Questions tagged [tsibble]

R package for tidy time series (tsibble: Tidy Temporal Data Frames and Tools)

tsibble: Tidy Temporal Data Frames and Tools

Provides a 'tbl_ts' class (the 'tsibble') for temporal data in an data- and model-oriented format.

The 'tsibble' provides tools to easily manipulate and analyse temporal data, such as filling in time gaps, aggregating over calendar periods, and etc.

119 questions
1
vote
1 answer

Changing labels and breaks with ggplot2 and tsibble

Since we can't use scale_x_date() with a {tsibble} object, what's the approach to change breaks, labels etc? # metapackage library(fpp3) # data melsyd_economy <- ansett %>% filter(Airports == "MEL-SYD", Class == "Economy") %>% mutate(Passengers…
Alberson Miranda
  • 1,248
  • 7
  • 25
1
vote
0 answers

R tsibble STL decomposition says there are missing date values but there aren't any

library(ggplot2) library(dplyr) library(tsibble) library(feasts) structure(list(Date = structure(c(18809, 18810, 18811, 18812, 18813, 18814, 18815, 18816, 18817, 18818, 18819, 18820, 18821, 18822, 18823, 18824, 18825, 18826, 18827, 18828, 18829,…
hachiko
  • 671
  • 7
  • 20
1
vote
0 answers

tsibble : adding NA into the incomplete low-frequency values using index_by and summarize

library(tsibble) library(dplyr) example <- as_tsibble(ts(rep(1,10),frequency = 12,start=2010)) example %>% index_by(quarter = ~ yearquarter(.)) %>% summarize(value=sum(value)) # A tsibble: 4 x 2 [1Q] # quarter value # #1 2010…
Arnaud Feldmann
  • 761
  • 5
  • 17
1
vote
1 answer

problem using a dynamic trend or seasonal parameter with ETS with fable and purrr

I have a tsibble as shown below. test.data <- structure(list(RSLITM = c("004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004", "004",…
LauraDR
  • 86
  • 9
1
vote
1 answer

Adjust date on x-axis for fpp3 autoplot()

A quick reprex from the book's website: melsyd_economy <- ansett %>% filter(Airports == "MEL-SYD", Class == "Economy") %>% mutate(Passengers = Passengers/1000) autoplot(melsyd_economy, Passengers) + labs(title = "Ansett airlines economy…
Blake Shurtz
  • 321
  • 3
  • 13
1
vote
1 answer

R: diff() and tsibble - must be size n or 1 not n-2

Given: test <- tsibble( date = lubridate::now() + 0:9, value = rnorm(10) ) %>% mutate (vdiff =diff(value, differences = 2)) How do I avoid the following : Error: Problem with mutate() column vdiff. ℹ vdiff = diff(value, differences = 2,…
Little Code
  • 1,315
  • 2
  • 16
  • 37
1
vote
1 answer

Mutate statement not working to enable graph

Working through a tidyverse time series example on the sunspot data, getting the following error message when I try to graph in 10 year increments, seems to not recognize the new date variable created in step 1, wondering if this is a format…
Ricky
  • 123
  • 9
1
vote
2 answers

Convert tibble to time series

I tried to download data on covid provided by the Economist's Github repository. library(readr) library(knitr) myfile <-…
mfeldk
  • 11
  • 3
1
vote
1 answer

Retrieve last n rows from tsibble object - R

I have a tsibble matrix that grows 32 rows larger every day from incoming data, I would like to only plot the past 5 days in my plotting function which requires me to subset (32*5) 160 of the bottom rows. The dates for each row change every 32 rows,…
JJ Fantini
  • 213
  • 1
  • 11
1
vote
1 answer

How to get value from agg_vec in R?

I am working with fpp3 forecasting package in R in order to produce a hierarchical forecast but I only need the forecast of the lower levels. Sadly, all values came in an agg_vec type which is not something I want. Is there anyway to extract its…
alqacer
  • 37
  • 1
  • 5
1
vote
2 answers

maximum value by groups using dplyr does not work in tsibble dataframe

I am working on the gafa_stock dataframe in the tsibbledata package. I want to find the maximum closing stock price for the each of the four stocks in the dataframe. Since the dataframe has four stocks I want to get a table with four rows with each…
Piyush Shah
  • 301
  • 4
  • 15
1
vote
2 answers

R tsibble add support for custom index

Problem description I work with trice monthly data a lot. Trice monthly (or roughly every 10 days, also referred to as a dekad) it is the typical reporting interval for water related data in the former Soviet Union and for many more climate/water…
mabe
  • 125
  • 1
  • 10
1
vote
1 answer

Error: Objects of type ts not supported by autoplot. Cannot knit RMarkdown (packages `fpp2` vs `fpp3`)

I have a small problem with Rob Hyndman's packages fpp2 and fpp3. I have ts object head(visitors) [1] "ts" May Jun Jul Aug Sep Oct 1985 75.7 75.4 83.1 82.9 77.3 105.7 Both packages fpp2 and fpp3 allow me to make a chart, using…
Anakin Skywalker
  • 2,400
  • 5
  • 35
  • 63
1
vote
1 answer

Sliding windows: compare series with all series before/after

I'm fairly new to rolling windows. I'm looking to calculate a function that compares, say, a correlation between a window in the data vs. all windows before/after of the same size. Assume no gaps. I'd like to use a tidyverse-sque approach such as…
Thomas Speidel
  • 1,369
  • 1
  • 14
  • 26
1
vote
1 answer

Can't convert a tsibble to a fable

I do not have a workaround for this at the moment, so desperately looking to solve this issue, no matter how cumbersome as long as my code is working again... I want to coerce a tsibble to a fable object with: as_fable Documentation says that this…
Nhaj
  • 23
  • 3