Is there any suitable program to fix the indents of a R script already written?
For example if it is fed an script like this:
foo = function(x) {
a = 1
print(a)
}
It converts it to:
foo = function(x) {
a = 1
print(a)
}
Or better?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, use Yihui’s formatR package.
Demo with before and after:
You can of course redirect to a new file using
tidy.source(..., file="NewFile.R")