Gabor Grothendieck wrote: > On Fri, Mar 13, 2009 at 10:11 AM, Wacek Kusnierczyk > <waclaw.marcin.kusnierc...@idi.ntnu.no> wrote: > >> Gabor Grothendieck wrote: >> >>> If all your code has semicolons you could write a program that >>> puts each statement on one line based on the semicolons and >>> then passing it through R will reformat it in a standard way. >>> See Rtidy.bat in the batchfiles distribution for the reformatting part: >>> http://batchfiles.googlecode.com >>> >>> >> for the "puts each statement on one line based on the semicolons" part, >> it's enough to pass the program through a simple sed script, *provided* >> that each line not ending in a semicolon is not a complete line: >> >> sed -n '/;\s*$/!{H}; /;\s*$/{H;g;s/\n//g;s/;\s*$//;p;s/.//g;h}' >> input > output >> >> (i guess this can be simplified.) >> >> > > One would want to be sure that a comment is not continued onto > a code line. >
of course; you'd have to handle comments separately. vQ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.