[R] What's the best way to tell a function about relevant fields in data frames

Zeljko Vrba zvrba at ifi.uio.no
Tue May 12 12:26:48 CEST 2009


On Tue, May 12, 2009 at 12:18:59PM +0200, Titus von der Malsburg wrote:
> 
> Is there a canonical way to tell a function which fields in a data
> frame are relevant?  What other alternatives are possible?  What are
> the pros and cons of the alternatives?
> 
Why not simply rearrange your data frames to have standardized column names
(see names() function), and write functions that operate on the standardized
format?  The change need not be destructive, you can first make a copy of the
data.

If all data frames have the same sequence of variables (time, x, y), you can
just use indices to refer to the columns, e.g. 1 corresponds to the time
variable.




More information about the R-help mailing list