| tidy.source {animation} | R Documentation |
Actually this function has nothing to do with code optimization; it just returns parsed source code.
tidy.source(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.
None (invisible `NULL'). `Clean' code will be returned to the console unless the output is redirected by `sink'.
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.source(x)
# to a file
tidy.source(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.source("clipboard")
## End(Not run)