Re: [R] Simple R Question...

2011-05-21 Thread David Winsemius
On May 21, 2011, at 7:37 AM, Lars Bishop wrote: Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I want to make my selection based on a vector of na

Re: [R] Simple R Question...

2011-05-21 Thread Patrick Burns
Are you looking for: dd[, "a", drop=FALSE] On 21/05/2011 12:37, Lars Bishop wrote: Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I want to make m

Re: [R] Simple R Question...

2011-05-21 Thread Jeff Newmiller
Or dd[,myname] should work too. If you are worried about getting multiple columns, you can just make myname a vector of column names using c() before you use either Jim's list indexing or the above matrix indexing syntax.

Re: [R] Simple R Question...

2011-05-21 Thread Jim Holtman
dd[[ myname]] Sent from my iPad On May 21, 2011, at 7:37, Lars Bishop wrote: > Let's say I have the data frame 'dd' below. I'd like to select one > column from this data frame (say 'a') and keep its name in the > resulting data frame. That can be done as in #2. However, what if I > want to make

[R] Simple R Question...

2011-05-21 Thread Lars Bishop
Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I want to make my selection based on a vector of names (and again keep those names in the resulting dat