as_task_classif_st {mlr3spatiotempcv} | R Documentation |
Convert to a Spatiotemporal Classification Task
Description
Convert an object to a TaskClassifST. This is a S3 generic for the following objects:
-
TaskClassifST: Ensure the identity.
-
data.frame()
and DataBackend: Provides an alternative to the constructor of TaskClassifST. -
sf::sf: Extracts spatial meta data before construction.
-
TaskRegr: Calls
convert_task()
.
Usage
as_task_classif_st(x, ...)
## S3 method for class 'TaskClassifST'
as_task_classif_st(x, clone = FALSE, ...)
## S3 method for class 'data.frame'
as_task_classif_st(
x,
target,
id = deparse(substitute(x)),
positive = NULL,
coordinate_names,
crs = NA_character_,
coords_as_features = FALSE,
label = NA_character_,
...
)
## S3 method for class 'DataBackend'
as_task_classif_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_classif_st(
x,
target = NULL,
id = deparse(substitute(x)),
positive = NULL,
coords_as_features = FALSE,
label = NA_character_,
...
)
Arguments
x |
(any) |
... |
(any) |
clone |
( |
target |
( |
id |
( |
positive |
( |
coordinate_names |
( |
crs |
( |
coords_as_features |
( |
label |
( |
Value
Examples
if (mlr3misc::require_namespaces(c("sf"), quietly = TRUE)) {
library("mlr3")
data("ecuador", package = "mlr3spatiotempcv")
# data.frame
as_task_classif_st(ecuador, target = "slides", positive = "TRUE",
coords_as_features = FALSE,
crs = "+proj=utm +zone=17 +south +datum=WGS84 +units=m +no_defs",
coordinate_names = c("x", "y"))
# sf
ecuador_sf = sf::st_as_sf(ecuador, coords = c("x", "y"), crs = 32717)
as_task_classif_st(ecuador_sf, target = "slides", positive = "TRUE")
}