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

transmute() and tibble results #4667

Merged
merged 4 commits into from
Dec 17, 2019
Merged

transmute() and tibble results #4667

merged 4 commits into from
Dec 17, 2019

Conversation

romainfrancois
Copy link
Member

library(dplyr, warn.conflicts = FALSE)

iris %>% 
  as_tibble() %>% 
  transmute(
    tibble(Sepal.Length, Sepal.Width)
  )
#> # A tibble: 150 x 2
#>    Sepal.Length Sepal.Width
#>           <dbl>       <dbl>
#>  1          5.1         3.5
#>  2          4.9         3  
#>  3          4.7         3.2
#>  4          4.6         3.1
#>  5          5           3.6
#>  6          5.4         3.9
#>  7          4.6         3.4
#>  8          5           3.4
#>  9          4.4         2.9
#> 10          4.9         3.1
#> # … with 140 more rows

instead of this on master, which insist on giving names to each ...

library(dplyr, warn.conflicts = FALSE)

iris %>% 
  as_tibble() %>% 
  transmute(
    tibble(Sepal.Length, Sepal.Width)
  )
#> # A tibble: 150 x 1
#>    `tibble(Sepal.Length, Sepal.Width)`$Sepal.Length $Sepal.Width
#>                                               <dbl>        <dbl>
#>  1                                              5.1          3.5
#>  2                                              4.9          3  
#>  3                                              4.7          3.2
#>  4                                              4.6          3.1
#>  5                                              5            3.6
#>  6                                              5.4          3.9
#>  7                                              4.6          3.4
#>  8                                              5            3.4
#>  9                                              4.4          2.9
#> 10                                              4.9          3.1
#> # … with 140 more rows

Created on 2019-12-17 by the reprex package (v0.3.0.9000)

This is slightly related to #2047 as we would be able, with #4586 to do something like:

library(dplyr, warn.conflicts = FALSE)

iris %>% 
  transmute(
    Sepal = Sepal.Length * Sepal.Width
    across(everything())
  )

@romainfrancois romainfrancois merged commit f9fdab1 into master Dec 17, 2019
@romainfrancois romainfrancois deleted the mutate_transmute branch December 17, 2019 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant