Re: [R] Access variables by string

2010-02-12 Thread Philipp Rappold
Thanks a lot guys, looks like there are -as usual- a gazillion options ;)) f = function(x, vars) x[complete.cases(x[vars]),] seems to be the most appropriate in my case though. Best Philipp Benilton Carvalho wrote: On Thu, Feb 11, 2010 at 4:18 PM, Philipp Rappold wrote: Dear all, I have

Re: [R] Access variables by string

2010-02-11 Thread Dan davison
Philipp Rappold gmail.com> writes: > > Dear all, > [...] > (2) I need this functionality for a customized na.exclude() function > that I am building, which should only exclude rows that have NA in > certain columns. Maybe there is already a function which does > exactly what I need, so I'd h

Re: [R] Access variables by string

2010-02-11 Thread Benilton Carvalho
On Thu, Feb 11, 2010 at 4:18 PM, Philipp Rappold wrote: > Dear all, > > I have two probably very easy questions: > > (1) Is there a way to access certain variables by their string-based name > representation? > > Example: > numbers <- c("one", "two", "three") > varname <- "numbers" > print(varname

Re: [R] Access variables by string

2010-02-11 Thread Don MacQueen
For your first question, use the get() function -Don At 5:18 PM +0100 2/11/10, Philipp Rappold wrote: Dear all, I have two probably very easy questions: (1) Is there a way to access certain variables by their string-based name representation? Example: numbers <- c("one", "two", "three") va

Re: [R] Access variables by string

2010-02-11 Thread Peter Dalgaard
Philipp Rappold wrote: > Dear all, > > I have two probably very easy questions: > > (1) Is there a way to access certain variables by their string-based > name representation? > > Example: > numbers <- c("one", "two", "three") > varname <- "numbers" > print(varname[2]) > > (2) I need this funct