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 support for magrittr #54

Closed
g4challenge opened this issue Jun 3, 2016 · 3 comments
Closed

Add support for magrittr #54

g4challenge opened this issue Jun 3, 2016 · 3 comments

Comments

@g4challenge
Copy link

Please add reformatting for magrittr pipe operator %>%.

For example:
result <- mydata %>% filter(criterion) %>% group_by(mygroup) %>% summarise(summand = sum(count))

should be converted to something like:

mydata %>%
  filter(criterion) %>%
    group_by(mygroup) %>%
      summarise(summand = sum(count)) -> results
@edlee123
Copy link
Contributor

edlee123 commented Jul 3, 2016

Another example:

testfunc = function(){

  testout <- mtcars %>%
    mutate(mpgXcyl = mpg * cyl) %>%
    arrange(desc(disp), hp) %$% 
    carb
  return(testout)
}
> tidy_source()
Error in parse(text = lines, keep.source = TRUE) : 
  <text>:8:0: unexpected end of input
6:     carb
7:   return(testout)
  ^
> 

@yihui
Copy link
Owner

yihui commented Jul 7, 2016

My reply would be the same as in #53...

@edlee123 edlee123 mentioned this issue May 7, 2017
yihui added a commit to yihui/yihui.org that referenced this issue Dec 7, 2017
yihui added a commit that referenced this issue Mar 15, 2021
@yihui yihui closed this as completed in 5de39f1 Mar 15, 2021
@yihui
Copy link
Owner

yihui commented Mar 15, 2021

@g4challenge This has been implemented. You can install the development version via

remotes::install_github('yihui/formatR')

Thanks!

@edlee123 This turns out to be a different bug, which I fixed in ff21861.

> tidy_source() Error in parse(text = lines, keep.source = TRUE) : <text>:8:0: unexpected end of input 6: carb 7: return(testout) ^

yihui added a commit that referenced this issue Mar 15, 2021
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

No branches or pull requests

3 participants