I have some data concerning events that take place at irregular intervals, where the only thing that matters is the order. I am trying to use some of the functions from the tidyverts universe (which replaces the forecast package), by declaring a sequence of consecutive integers as my time index. I’ve been getting an error I dont understand:
Error in UseMethod("measured_vars") :
no applicable method for 'measured_vars' applied to an object of class "c('double', 'numeric')"
the “measured_vars" function is in the tsibble package. (ACF and autoplot are from feasts
). Its documentation reads:
Usage
measured_vars(x)
Arguments
x
A tbl_ts.
Examples
measured_vars(pedestrian)
which strikes me as unhelpful. measured_vars is a generic function. It has one method: measured_vars.tbl_ts*
My object is of class tbl_ts. GetAnywhere reports that it is an S3 method in the tsibble namespace:
function (x)
{
all_vars <- names(x)
key_vars <- key_vars(x)
idx_var <- index_var(x)
setdiff(all_vars, c(key_vars, idx_var))
}
<bytecode: 0x0000023673afa460>
<environment: namespace:tsibble>
This code yields the same error:
library("fpp3")
ind. <-1:4
data. <-c(3,2,6,6)
data_ts <- as_tsibble(data.frame(ind., data.), index = "ind.")
autoplot(ACF(data_ts$data.))
I recognise that the function that throws the error, measured_vars
, says it wants a tsibble and I am handing it a column in a tsibble. But feasts::ACS also says it wants a tsibble, and I do not believe it is asking for nested tsibbles.