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
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
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.
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
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
5 matches
Mail list logo