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

Add .before and .after arguments to mutate #291

Merged
merged 4 commits into from
Aug 30, 2021

Conversation

eutwt
Copy link
Collaborator

@eutwt eutwt commented Aug 29, 2021

Example with this PR loaded:

library(dtplyr)
library(dplyr, warn.conflicts = FALSE)

lazy_dt(data.frame(x = 1, y = 1)) %>% 
  mutate(z = 1, .before = y)
#> Source: local data table [1 x 3]
#> Call:   setcolorder(copy(`_DT1`)[, `:=`(z = 1)], c("x", "z", "y"))
#> 
#>       x     z     y
#>   <dbl> <dbl> <dbl>
#> 1     1     1     1
#> 
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results

Created on 2021-08-29 by the reprex package (v2.0.1)

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I don't think dtplyr needs to provide experimental arguments, but I'm pretty sure that all the current dplyr experimental arguments are going to stay, so this still makes sense. Otherwise looks good, just one small styling suggestion and it needs a news bullet 😄

expect_named(
mutate(dt, z = 1, .before = x) %>% as_tibble(),
c("z", "x", "y")
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indenting is slightly off here and below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed.

@eutwt
Copy link
Collaborator Author

eutwt commented Aug 30, 2021

Should be all set now

@hadley hadley merged commit a1c8132 into tidyverse:master Aug 30, 2021
@hadley
Copy link
Member

hadley commented Aug 30, 2021

BTW we add news bullets to the top, since it makes resolving the merge conflicts a little easier.

@eutwt eutwt deleted the mutate-before-after branch August 30, 2021 16:48
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.

2 participants