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

pvec() with .flatten=TRUE does not work for data frames #8

Closed
jtrecenti opened this issue Aug 2, 2018 · 1 comment
Closed

pvec() with .flatten=TRUE does not work for data frames #8

jtrecenti opened this issue Aug 2, 2018 · 1 comment
Assignees

Comments

@jtrecenti
Copy link
Member

I think pvec() should work like purrr::map_dfr() when .flatten = TRUE

# devtools::install_github("abjur/abjutils")
fun <- function(x) {
  Sys.sleep(1)
  mtcars
}
res <- abjutils::pvec(letters, fun)
#> 
 Progress: ────────────                                                                       100%
 Progress: ─────────────────────────                                                          100%
 Progress: ─────────────────────────────────────                                              100%
 Progress: ──────────────────────────────────────────────────                                 100%
 Progress: ──────────────────────────────────────────────────                                 100%
 Progress: ───────────────────────────────────────────────────────────────                    100%
 Progress: ───────────────────────────────────────────────────────────────────────────        100%
 Progress: ───────────────────────────────────────────────────────────────────────────        100%
 Progress: ────────────────────────────────────────────────────────────────────────────────── 100%
 Progress: ────────────────────────────────────────────────────────────────────────────────── 100%
res
#> # A tibble: 26 x 3
#>       id return output                
#>    <int> <chr>  <list>                
#>  1     1 result <data.frame [32 × 11]>
#>  2     2 result <data.frame [32 × 11]>
#>  3     3 result <data.frame [32 × 11]>
#>  4     4 result <data.frame [32 × 11]>
#>  5     5 result <data.frame [32 × 11]>
#>  6     6 result <data.frame [32 × 11]>
#>  7     7 result <data.frame [32 × 11]>
#>  8     8 result <data.frame [32 × 11]>
#>  9     9 result <data.frame [32 × 11]>
#> 10    10 result <data.frame [32 × 11]>
#> # ... with 16 more rows
res <- abjutils::pvec(letters, fun, .flatten = TRUE)
#> 
 Progress: ────────────                                                                       100%
 Progress: ─────────────────────────                                                          100%
 Progress: ─────────────────────────────────────                                              100%
 Progress: ──────────────────────────────────────────────────                                 100%
 Progress: ──────────────────────────────────────────────────                                 100%
 Progress: ───────────────────────────────────────────────────────────────                    100%
 Progress: ───────────────────────────────────────────────────────────────────────────        100%
 Progress: ───────────────────────────────────────────────────────────────────────────        100%
 Progress: ────────────────────────────────────────────────────────────────────────────────── 100%
 Progress: ────────────────────────────────────────────────────────────────────────────────── 100%
#> Error in eval_tidy(enquo(var), var_env): object 'output' not found

Also, should we assume that there will be no errors when .flatten = TRUE?

@clente
Copy link
Contributor

clente commented Aug 2, 2018

Enhanced in 911c5c8

@clente clente closed this as completed Aug 2, 2018
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

2 participants