Skip to content

Commit

Permalink
- cookfarm task: include NA observations and set column roles "space"…
Browse files Browse the repository at this point in the history
… and "time" by default
  • Loading branch information
pat-s committed Jun 2, 2022
1 parent 8752e6c commit 141b76c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
12 changes: 11 additions & 1 deletion R/Task_regr_cookfarm_profiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@
#'
#' Here, only the "Profiles" dataset is used from the collection.
#' The `Date` column was appended from the `readings` dataset.
#' 500 random samples were drawn from the complete sample.
#' In addition coordinates were appended to the task as variables `"x"` and `"y"`.
#'
#' The dataset was borrowed and adapted from package GSIF which was on archived on
#' CRAN in 2021-03.
#'
#' @section Column roles:
#' The task has set column roles "space" and "time" for variables `"Date"` and
#' `"SOURCEID"`, respectively.
#' These are used by certain methods during partitioning, e.g.,
#' `mlr_resamplings_sptcv_cstf` with variant "Leave-location-and-time-out".
#' If only one of space or time should left out, the column roles must be
#' adjusted by the user!
#'
#' @references
#' Gasch, C.K., Hengl, T., Gräler, B., Meyer, H., Magney, T., Brown, D.J., 2015.
#' Spatio-temporal interpolation of soil water, temperature, and electrical
Expand All @@ -49,5 +57,7 @@ load_task_cookfarm = function(id = "cookfarm") {
extra_args = list(
coordinate_names = c("x", "y"), coords_as_features = FALSE,
crs = 26911))
task$set_col_roles("Date", roles = "time")
task$set_col_roles("SOURCEID", roles = "space")
return(task)
}
10 changes: 5 additions & 5 deletions data-raw/cookfarm_sample.R → data-raw/cookfarm_mlr3.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ cookfarm_mlr3_sf = cookfarm_profiles %>%
dplyr::mutate(y = sf::st_coordinates(.)[, "Y"]) %>%
dplyr::mutate(Date = as.character(Date))

cookfarm_sample = cookfarm_mlr3_sf %>%
sf::st_set_geometry(NULL) %>%
stats::na.omit()
cookfarm_mlr3 = cookfarm_mlr3_sf %>%
sf::st_set_geometry(NULL) # %>%
# stats::na.omit()

# mapview::mapview(cookfarm_sample)
# mapview::mapview(cookfarm_mlr3)

usethis::use_data(cookfarm_sample, overwrite = TRUE)
usethis::use_data(cookfarm_mlr3, overwrite = TRUE)
Binary file added data/cookfarm_mlr3.rda
Binary file not shown.
12 changes: 11 additions & 1 deletion man/mlr_tasks_cookfarm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 141b76c

Please sign in to comment.