Skip to content

Commit

Permalink
rename cookfarm_sample task to cookfarm_mlr3
Browse files Browse the repository at this point in the history
  • Loading branch information
pat-s committed Jun 2, 2022
1 parent 6792a5c commit e9cfa5a
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions R/Task_regr_cookfarm_profiles.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' @title Cookfarm Profiles Regression Task
#'
#' @docType data
#' @usage data(cookfarm_sample)
#' @usage data(cookfarm_mlr3)
#' @name mlr_tasks_cookfarm
#' @format [R6::R6Class] inheriting from [TaskRegr].
#'
Expand Down Expand Up @@ -47,10 +47,10 @@
#' modeling the spatial and temporal variation of soil moisture in a dryland
#' agricultural field. Submitted to Water Resources Research.
#' @template seealso_task
"cookfarm_sample"
"cookfarm_mlr3"

load_task_cookfarm = function(id = "cookfarm") {
b = mlr3::as_data_backend(cookfarm_sample)
b = mlr3::as_data_backend(cookfarm_mlr3)
b$hash = "_mlr3_tasks_cookfarm_"
task = TaskRegrST$new(
id = "cookfarm", b, target = "PHIHOX",
Expand Down
6 changes: 3 additions & 3 deletions R/as_task_regr_st.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
#' @examples
#' if (mlr3misc::require_namespaces(c("sf"), quietly = TRUE)) {
#' library("mlr3")
#' data("cookfarm_sample", package = "mlr3spatiotempcv")
#' data("cookfarm_mlr3", package = "mlr3spatiotempcv")
#'
#' # data.frame
#' as_task_regr_st(cookfarm_sample, target = "PHIHOX",
#' 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_sample, coords = c("x", "y"), crs = 26911)
#' cookfarm_sf = sf::st_as_sf(cookfarm_mlr3, coords = c("x", "y"), crs = 26911)
#' as_task_regr_st(cookfarm_sf, target = "PHIHOX")
#'
#' # TaskRegrST
Expand Down
2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"_PACKAGE"

utils::globalVariables(c(
"row_id", "cookfarm_sample", "ecuador", "diplodia",
"row_id", "cookfarm_mlr3", "ecuador", "diplodia",
"resampling", "task", "indicator", "fold", "id", "type",
"fold_space", "fold_time"))

Expand Down
2 changes: 1 addition & 1 deletion data-raw/cookfarm_mlr3.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## code to prepare `cookfarm_sample` dataset goes here
## code to prepare `cookfarm_mlr3` dataset goes here

# retrieved from package https://github.com/envirometrix/landmap after GSIF was archived on CRAN in 2021-03
set.seed(42)
Expand Down
Binary file removed data/cookfarm_sample.rda
Binary file not shown.
6 changes: 3 additions & 3 deletions man/as_task_regr_st.Rd

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

4 changes: 2 additions & 2 deletions man/mlr_tasks_cookfarm.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/test-1-autoplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ test_that("autoplot time + space", {
skip_if_not_installed("patchwork")
skip_if_not_installed("ggtext")
# special data with five temporal levels
data = cookfarm_sample
data = cookfarm_mlr3
b = mlr3::as_data_backend(data)
b$hash = "_mlr3_tasks_cookfarm_"
task = TaskRegrST$new(
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-as_task.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ test_that("as_task_regr_st.TaskRegrST works", {
})

test_that("as_task_regr_st.data.rame works", {
data("cookfarm_sample", package = "mlr3spatiotempcv")
new_task = as_task_regr_st(cookfarm_sample, target = "PHIHOX",
data("cookfarm_mlr3", package = "mlr3spatiotempcv")
new_task = as_task_regr_st(cookfarm_mlr3, target = "PHIHOX",
id = "cookfarm",
coords_as_features = FALSE,
crs = 26911,
Expand All @@ -50,8 +50,8 @@ test_that("as_task_regr_st.data.rame works", {

test_that("as_task_regr_st.sf works", {
skip_if_not_installed("sf")
data("cookfarm_sample", package = "mlr3spatiotempcv")
cookfarm_sf = sf::st_as_sf(cookfarm_sample, coords = c("x", "y"), crs = 26911)
data("cookfarm_mlr3", package = "mlr3spatiotempcv")
cookfarm_sf = sf::st_as_sf(cookfarm_mlr3, coords = c("x", "y"), crs = 26911)
new_task = as_task_regr_st(cookfarm_sf, target = "PHIHOX")

expect_class(new_task, "TaskRegrST")
Expand Down

0 comments on commit e9cfa5a

Please sign in to comment.