Re: [R] r tidy

From: George Georgalis <>
Date: Thu 25 Jan 2007 - 19:35:21 GMT

>On Thu, 25 Jan 2007, George Georgalis wrote:
>>Is there an r-tidy program? something that works similar to perl
>>tidy? which takes program code
>>and reformats white space with standard indentations and spacing?
>>I did find a ruby based rtidy, but that is for html formatting.

On Thu, Jan 25, 2007 at 04:29:06PM +0000, Prof Brian Ripley wrote:
>It is called R.
>See the `Writing R Extensions' manual, section 3.1 (the obvious manual,

yes, well actually that was one of the first items I found in my search. but on first pass I was confused, on second pass I understood (sorta incorrectly) that it was about preserving source when writing packages -- then I posted my question.

looking at it again I see the technique could be used to tidy r scripts, but surly the first, the second paragraph or the rest of the section was not written to aid programmers for script tidying? "R treats function code loaded from packages and code entered by users differently."...

Maybe it could go something like this "Your R scripts can be sourced and dumped into a standard tidy format." (insert brief explanation of keep.source, source and dump; which I think I grasp but wouldn't try to explain)

Here's a script to tidy a file as argument $1

R --vanilla <<EOF

     options(keep.source = FALSE)
     dump(ls(all = TRUE), file = "${1}.tidy.R")
EOF yes, works great, but as one with nearly zero r experience, hoping to apply my other language experience to some R spaghetti, did frighten me off, the first time.

// George

George Georgalis, systems architect, administrator <IXOYE><

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri Jan 26 06:41:47 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 Jan 2007 - 20:30:38 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.