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

Fix .id arg missing in imap_dfr #454

merged 5 commits into from Feb 5, 2018

Fix .id arg missing in imap_dfr #454

merged 5 commits into from Feb 5, 2018


Copy link

@cderv cderv commented Feb 5, 2018

This is a small PR that fixes #429

  • .id argument in imap_dfr is now took into account (see reprex below)

  • unused .id argument in imap_dfc is now suppressed

  • Verifying if it was all, I found that in flatten_df* verbs there was no check if dplyr is installed or not as in map_df*, map2_df*, and pmap_df*. As it is small changes, I have included in this PR rather than opening a new one

Checking the fix

as_tibble_custom <- function(value, name = NULL) {
  tab <- tibble::as_tibble(value)
  if (! is.null(name)) {
    tab$col_id = paste0("col_", name)
# with imap it does not work
list(a = 1, b = 2, c = 3) %>%
#> # A tibble: 3 x 2
#>   value col_id
#>   <dbl> <chr> 
#> 1  1.00 col_a 
#> 2  2.00 col_b 
#> 3  3.00 col_c
list(a = 1, b = 2, c = 3) %>%
  imap_dfr(as_tibble_custom, .id = "name")
#> # A tibble: 3 x 3
#>   name  value col_id
#>   <chr> <dbl> <chr> 
#> 1 a      1.00 col_a 
#> 2 b      2.00 col_b 
#> 3 c      3.00 col_c Outdated
@@ -1,6 +1,10 @@

# purrr

* `flatten_dfr` and `flatten_dfc` now aborts if `dplyr` is not installed. (#454)

This comment has been minimized.


hadley Feb 5, 2018

House style is to not put package names in back ticks, and to put () after function names. Can you please change?

This comment has been minimized.


cderv Feb 5, 2018
Author Contributor

Oh sorry for that. I will definitely remember that for next time.
And revise the tidyverse style guide.
Correction is done.

@hadley hadley merged commit f7010b7 into tidyverse:master Feb 5, 2018
1 check was pending
1 check was pending
continuous-integration/travis-ci/pr The Travis CI build is in progress
@cderv cderv deleted the cderv:fix-id-arg branch Feb 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants