| tidy.source2 {animation} | R Documentation |
This function differs with tidy.source merely in this aspect: it preserves comments in complete lines.
tidy.source2(source = "clipboard", ...)
source |
a string: location of the source code |
... |
other arguments passed to cat, e.g. file |
This function helps the user to tidy up his source code in a sense that necessary indents and spaces will be added, etc. See parse. Comments which occupy complete lines will be preserved, but those mixed with code lines will be deleted.
None (invisible `NULL'). `Clean' code will be returned to the console unless the output is redirected by sink.
Yixuan Qiu and Yihui Xie
http://animation.yihui.name/animation:misc#tidy_up_r_source
## tidy up the source code of image demo
x = file.path(system.file(package = "graphics"), "demo", "image.R")
# to console
tidy.source2(x)
# try tidy.source(x) to see the difference
# to a file
tidy.source2(x, file = tempfile())
## check the original code here and see the difference
file.show(x)
## if you've copied R code into the clipboard
## Not run:
tidy.source2("clipboard")
## End(Not run)