Re: [R] Select columns of a data.frame by name OR index in a function

2011-11-03 Thread Jean V Adams
Thaler, Thorn, LAUSANNE, Applied Mathematics wrote on 11/03/2011 08:48:26 AM: > > Dear all, > > Sometimes I have the situation where a function takes a data.frame and > an additional argument describing come columns. For greater flexibility > I want to allow for either column names or column ind

[R] Select columns of a data.frame by name OR index in a function

2011-11-03 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Dear all, Sometimes I have the situation where a function takes a data.frame and an additional argument describing come columns. For greater flexibility I want to allow for either column names or column indices. What I usually do then is something like the following: -8<-