as_task_regr_st.TaskClassifST {mlr3spatiotempcv} | R Documentation |
Convert to a Spatiotemporal Regression Task
Description
Convert object to a TaskRegrST.
This is a S3 generic, specialized for at least the following objects:
-
TaskRegrST: Ensure the identity.
-
data.frame()
and DataBackend: Provides an alternative to the constructor of TaskRegrST. -
sf::sf: Extracts spatial meta data before construction.
-
TaskClassif: Calls
convert_task()
.
Usage
## S3 method for class 'TaskClassifST'
as_task_regr_st(
x,
target = NULL,
drop_original_target = FALSE,
drop_levels = TRUE,
...
)
as_task_regr_st(x, ...)
## S3 method for class 'TaskRegrST'
as_task_regr_st(x, clone = FALSE, ...)
## S3 method for class 'data.frame'
as_task_regr_st(
x,
target,
id = deparse(substitute(x)),
coordinate_names,
crs = NA_character_,
coords_as_features = FALSE,
label = NA_character_,
...
)
## S3 method for class 'DataBackend'
as_task_regr_st(
x,
target,
id = deparse(substitute(x)),
positive = NULL,
coordinate_names,
crs,
coords_as_features = FALSE,
label = NA_character_,
...
)
## S3 method for class 'sf'
as_task_regr_st(
x,
target = NULL,
id = deparse(substitute(x)),
coords_as_features = FALSE,
label = NA_character_,
...
)
## S3 method for class 'TaskClassifST'
as_task_regr_st(
x,
target = NULL,
drop_original_target = FALSE,
drop_levels = TRUE,
...
)
Arguments
x |
(any) |
target |
( |
drop_original_target |
( |
drop_levels |
( |
... |
(any) |
clone |
( |
id |
( |
coordinate_names |
( |
crs |
( |
coords_as_features |
( |
label |
( |
positive |
( |
Value
Examples
if (mlr3misc::require_namespaces(c("sf"), quietly = TRUE)) {
library("mlr3")
data("cookfarm_mlr3", package = "mlr3spatiotempcv")
# data.frame
as_task_regr_st(cookfarm_mlr3, target = "PHIHOX",
coords_as_features = FALSE, crs = 26911,
coordinate_names = c("x", "y"))
# sf
cookfarm_sf = sf::st_as_sf(cookfarm_mlr3, coords = c("x", "y"), crs = 26911)
as_task_regr_st(cookfarm_sf, target = "PHIHOX")
}