[R] Extract only the values from a row

Sverre Stausland johnsen at fas.harvard.edu
Mon Jul 11 18:48:22 CEST 2011

Dear helpers,

how can I extract only the values from a row in a data frame? Using
[X,] doesn't do the trick:

> data.frame(letters[1:10],letters[11:20])->my.data
> my.data[1,]
  letters.1.10. letters.11.20.
1             a              k

I would like to be able to extract only the values "a" and "k" without
getting the row names and column names with them. I'm asking because I
want to assign the character values from a row as the names of the
columns of the data frame.


More information about the R-help mailing list