Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge case: rsplit object fails to store because dim() throws an error #1300

Closed
3 tasks done
wlandau opened this issue Jul 23, 2020 · 0 comments
Closed
3 tasks done

Edge case: rsplit object fails to store because dim() throws an error #1300

wlandau opened this issue Jul 23, 2020 · 0 comments
Assignees

Comments

@wlandau
Copy link
Member

wlandau commented Jul 23, 2020

Prework

  • Read and abide by drake's code of conduct.
  • Search for duplicates among the existing issues, both open and closed.
  • Be considerate of the maintainer's time and make it as easy as possible to troubleshoot any problems you identify. Read here and here to learn about minimal reproducible examples. Format your code according to the tidyverse style guide to make it easier for others to read.

Description

See https://stackoverflow.com/questions/63051383/error-when-using-initial-time-split-with-drake. Apparently drake cannot store rsplit objects because NROW() throws an error.

library(tidyverse)
library(tidymodels)
#> ── Attaching packages ─────────────────────────────────────── tidymodels 0.1.1 ──
#> ✓ broom     0.7.0      ✓ recipes   0.1.13
#> ✓ dials     0.0.8      ✓ rsample   0.0.7 
#> ✓ infer     0.5.3      ✓ tune      0.1.1 
#> ✓ modeldata 0.0.2      ✓ workflows 0.1.2 
#> ✓ parsnip   0.1.2      ✓ yardstick 0.0.7
#> ── Conflicts ────────────────────────────────────────── tidymodels_conflicts() ──
#> x scales::discard() masks purrr::discard()
#> x dplyr::filter()   masks stats::filter()
#> x recipes::fixed()  masks stringr::fixed()
#> x dplyr::lag()      masks stats::lag()
#> x yardstick::spec() masks readr::spec()
#> x recipes::step()   masks stats::step()

generate_data <- function() {
    tibble(x = rnorm(1e5), y = rnorm(1e5))
}

split_the_data <- function(data) {
    data %>% 
        initial_time_split()
}

NROW(split_the_data(generate_data()))
#> Error in UseMethod("complement"): no applicable method for 'complement' applied to an object of class "rsplit"

Created on 2020-07-23 by the reprex package (v0.3.0)

Reproducible example

library(drake)
library(tidyverse)
library(tidymodels)
#> ── Attaching packages ─────────────────────────────────────── tidymodels 0.1.1 ──
#> ✓ broom     0.7.0      ✓ recipes   0.1.13
#> ✓ dials     0.0.8      ✓ rsample   0.0.7 
#> ✓ infer     0.5.3      ✓ tune      0.1.1 
#> ✓ modeldata 0.0.2      ✓ workflows 0.1.2 
#> ✓ parsnip   0.1.2      ✓ yardstick 0.0.7
#> ── Conflicts ────────────────────────────────────────── tidymodels_conflicts() ──
#> x recipes::check()      masks drake::check()
#> x scales::discard()     masks purrr::discard()
#> x tidyr::expand()       masks drake::expand()
#> x dplyr::filter()       masks stats::filter()
#> x recipes::fixed()      masks stringr::fixed()
#> x rsample::gather()     masks tidyr::gather(), drake::gather()
#> x dplyr::lag()          masks stats::lag()
#> x yardstick::spec()     masks readr::spec()
#> x recipes::step()       masks stats::step()
#> x workflows::workflow() masks drake::workflow()

generate_data <- function() {
    tibble(x = rnorm(1e5), y = rnorm(1e5))
}

split_the_data <- function(data) {
    data %>% 
        initial_time_split()
}

plan <- drake_plan(
    data = generate_data(),
    split_data = split_the_data(data)
)

make(plan)
#> ▶ target data
#> ▶ target split_data
#> Error in UseMethod("complement"): no applicable method for 'complement' applied to an object of class "rsplit"

Created on 2020-07-23 by the reprex package (v0.3.0)

The traceback points to NROW(), which apparently fails for rsplit objects.

meta$size_vec <- NROW(undecorate_format_value(value))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant