Convert object to a TaskRegr. This is a S3 generic, specialized for at least the following objects:
TaskRegr: ensure the identity
formula, data.frame()
and DataBackend: provides an alternative to the constructor of TaskRegr.
TaskClassif: Calls convert_task()
.
as_task_regr(x, ...)# S3 method for TaskRegr
as_task_regr(x, clone = FALSE, ...)
# S3 method for data.frame
as_task_regr(x, target, id = deparse(substitute(x)), ...)
# S3 method for DataBackend
as_task_regr(x, target, id = deparse(substitute(x)), ...)
# S3 method for TaskClassif
as_task_regr(
x,
target = NULL,
drop_original_target = FALSE,
drop_levels = TRUE,
...
)
# S3 method for formula
as_task_regr(x, data, id = deparse(substitute(data)), ...)
(any) Object to convert.
(any) Additional arguments.
(logical(1)
)
If TRUE
, ensures that the returned object is not the same as the input x
.
(character(1)
)
Name of the target column.
(character(1)
)
Id for the new task.
Defaults to the (deparsed and substituted) name of the data argument.
(logical(1)
)
If FALSE
(default), the original target is added as a feature.
Otherwise the original target is dropped.
(logical(1)
)
If TRUE
(default), unused levels of the new target variable are dropped.
(data.frame()
)
Data frame containing all columns specified in formula x
.
# NOT RUN {
as_task_regr(datasets::mtcars, target = "mpg")
# }
Run the code above in your browser using DataLab