[R] Data Manipulation Question

David Winsemius dwinsemius at comcast.net
Fri Dec 4 06:14:09 CET 2009


On Dec 3, 2009, at 10:52 PM, Gray Calhoun wrote:

> The data import/export manual can elaborate on a lot of these; this is
> all straightforward, although many people would prefer to use a
> relational database for some of the things you mentioned.

See Wickham's pithy response to this.

> I'm not
> aware of a "goto" command in R, though (although I could be wrong).

In fairness to the OP, he did not ask if there were a go-to construct,  
but rather whether there were a "gosub" construct that supported  
"modular programming". My response would have been that calling  
modular functions (i.e., subroutines with defined arguments) is  
fundamental to R and the key to understanding how to use it with grace  
and efficiency. I would say that the concept of functional programming  
is to a much greater extent supported by R than by SAS, whose datastep  
mechanisms (as I remember them from earlier incarnation) in no way  
supported modular programming. I suspect that S and R arose precisely  
because of the mental straightjackets imposed by SAS.

-- 
David.


> --Gray
>
> On Thu, Dec 3, 2009 at 1:52 PM, John Filben <johnfilben at yahoo.com>  
> wrote:
>> Can R support data manipulation programming that is available in  
>> the SAS datastep?  Specifically, can R support the following:
>> -          Read multiple dataset one record at a time and compare  
>> values from each; then base on if-then logic write to multiple  
>> output files
>> -          Load a lookup table and then process a different file;  
>> based on if-then logic, access and lookup values in the table
>> -          Support modular “gosub”programming
>> -          Sort files
>> -          Date math and conversions
>> -          Would it be able to support the following type of logic:
>> o   Start
>> §  Read Record from File 1
>> §  Read Record from File 2
>> §  Match
>> ·         If Key 1 <> Key 2 and Key 1 < Key 2, Write to output file A
>> ·         If Key 1 = Key 2, Write to output file B
>> ·         If Key 1 <> Key 2 and Key 1 > Key 2, Write to output file  
>> C§  Goto Start until File 1 Done
>>  John Filben
>> Cell Phone - 773.401.2822
>> Email - johnfilben at yahoo.com
>>
>>
>>
>>        [[alternative HTML version deleted]]
>>
>>
>> ______________________________________________
>> R-help at 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.
>>
>>
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list