The aim of this is saving the annoyance of commenting a pipe %>%.
You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("alejandroxag/donothing")
library(donothing)When working with a series of instructions piped down together, it’s
straightforward to comment any of them, except the last one, since the
previous pipe is left pointing nowhere. donothing() is intended to be
that last line that won’t be commented.
Easier to do this
t <- tibble::tibble(x = 1:2) %>%
dplyr::mutate(y = letters[1:2]) %>%
# dplyr::mutate(y = LETTERS[1:7]) %>%
donothing::donothing()
t
#> # A tibble: 2 x 2
#> x y
#> <int> <chr>
#> 1 1 a
#> 2 2 brather than this
t <- tibble::tibble(x = 1:2) %>%
dplyr::mutate(y = letters[1:2]) #%>%
# dplyr::mutate(y = letters[1:7])
t
#> # A tibble: 2 x 2
#> x y
#> <int> <chr>
#> 1 1 a
#> 2 2 b