Convert to a Forecast Task
as_task_fcst.Rd
Convert object to a TaskFcst. This is a S3 generic. mlr3forecast ships with methods for the following objects:
TaskRegr: ensure the identity
data.frame()
and DataBackend: provides an alternative to the constructor of TaskFcst.
Usage
as_task_fcst(x, ...)
# S3 method for class 'TaskFcst'
as_task_fcst(x, clone = FALSE, ...)
# S3 method for class 'DataBackend'
as_task_fcst(
x,
target = NULL,
index = NULL,
freq = NULL,
id = deparse1(substitute(x)),
label = NA_character_,
...
)
# S3 method for class 'data.frame'
as_task_fcst(
x,
target = NULL,
index = NULL,
freq = NULL,
id = deparse1(substitute(x)),
label = NA_character_,
...
)
Arguments
- x
(any)
Object to convert.- ...
(any)
Additional arguments.- clone
(
logical(1)
)
IfTRUE
, ensures that the returned object is not the same as the inputx
.- target
(
character(1)
)
Name of the target column.- index
(
character(1)
)
Name of the column in the data containing the index.- freq
(
character(1)
)
Frequency of the time series.- id
(
character(1)
)
Id for the new task. Defaults to the (deparsed and substituted) name of the data argument.- label
(
character(1)
)
Label for the new instance.
Examples
as_task_fcst(tsbox::ts_dt(AirPassengers), target = "value", index = "time", freq = "monthly")
#> <TaskFcst:tsbox::ts_dt(AirPassengers)> (144 x 1)
#> * Target: value
#> * Properties: univariate
#> * Index: time
#> * Frequency: monthly