simpr icon indicating copy to clipboard operation
simpr copied to clipboard

Indexing error with unnamed two-sided formula

Open statisfactions opened this issue 5 years ago • 0 comments

specify() with a single formula provides a huge variety of mysterious output:

suppressPackageStartupMessages(library(simpr))
specify(y ~ 1 + 2)
#> Formula specification for 'x' detected. Assuming 'x' is the first formula.
#> 
#> To hide this message, or to avoid moving this formula first, use a different variable name.
#> Error in `purrr::pmap()`:
#> ℹ In index: 1.
#> ℹ With name: x.
#> Caused by error in `x[[2]][-1]`:
#> ! object of type 'symbol' is not subsettable
#> Backtrace:
#>      ▆
#>   1. ├─generics::specify(y ~ 1 + 2)
#>   2. ├─simpr:::specify.formula(y ~ 1 + 2)
#>   3. │ └─simpr:::add_specification(...)
#>   4. │   └─purrr::pmap(...)
#>   5. │     └─purrr:::pmap_("list", .l, .f, ..., .progress = .progress)
#>   6. │       ├─purrr:::with_indexed_errors(...)
#>   7. │       │ └─base::withCallingHandlers(...)
#>   8. │       ├─purrr:::call_with_cleanup(...)
#>   9. │       └─simpr (local) .f(.l[[1L]][[i]], .l[[2L]][[i]], .l[[3L]][[i]], ...)
#>  10. │         └─x[[2]][-1] %>% as.list() %>% purrr::map_chr(deparse)
#>  11. ├─purrr::map_chr(., deparse)
#>  12. │ └─purrr:::map_("character", .x, .f, ..., .progress = .progress)
#>  13. │   └─purrr:::vctrs_vec_compat(.x, .purrr_user_env)
#>  14. ├─base::as.list(.)
#>  15. └─purrr (local) `<fn>`(`<ntSbsttE>`)
#>  16.   └─cli::cli_abort(...)
#>  17.     └─rlang::abort(...)

Created on 2024-07-14 with reprex v2.0.2

There's both the confusion about the default option of specify() as well as the baffling indexing error which looks to be based on some internals that need some refactoring.

statisfactions avatar Dec 05 '19 16:12 statisfactions

Leaving open but will not fix for 0.2.0

statisfactions avatar Jan 03 '22 05:01 statisfactions