From 16fe64d6f5108662b6c75f256f87f02d508b0f2f Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Thu, 7 Dec 2017 10:00:10 -0600 Subject: [PATCH] document the failure of yihui/formatR#54 --- content/pkg-formatR.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/pkg-formatR.md b/content/pkg-formatR.md index 11b62f49f1..4a91dfe2c8 100644 --- a/content/pkg-formatR.md +++ b/content/pkg-formatR.md @@ -353,6 +353,10 @@ We can also use the right arrow `->` for assignment, e.g. `1:10 -> x`. I believe I recommend you to use `<-` or `=` consistently. What is more important is consistency. I always use `=` because it causes me no confusion (I do not believe it is ever possible for people to interpret `fun(a = 1)` as assigning `1` to a variable `a` instead of passing an argument value) and `<-` is more dangerous because it works everywhere (you might have unconsciously created a new variable `a` in `fun(a <- 1)`; see [an example here](https://stat.ethz.ch/pipermail/r-devel/2011-December/062786.html)). The only disadvantage is that most R people use `<-` so it may be difficult to collaborate with other people. +## The pipe operator `%>%` + +Although `tidy_source()` won't ruin your code that contains the pipes, you won't be happy with it: your line breaks after the pipes won't be preserved. See [#54](https://github.com/yihui/formatR/issues/54). + # 7. How does `tidy_source()` actually work? In a nutshell, `tidy_source(text = code)` is basically `deparse(parse(text = code))`, but actually it is more complicated only because of one thing: `deparse()` drops comments, e.g.,