Is there an r code I can use that will remove all of the comments from an .r file?
See tidy.source()
in the formatR package, option keep.comment = FALSE
And an example.... copy and paste the following (including the comment). Tidy source defaults to reading the clipboard for the code.
# This is a useless comment
for(i in 1:5){
print(i)
}
and then
> library(formatR)
> tidy.source(keep.comment = FALSE)
for (i in 1:5) {
print(i)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With