# \donttest{
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")
}
# }
Run the code above in your browser using DataLab