[R] How to extract row values?

Daniel Malter daniel at umd.edu
Thu Aug 20 15:59:28 CEST 2009

Assuming your data.frame has the name "data," you would extract arbitrary
row n by 

data[n, ]


cuncta stricte discussurus

-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Henrik Kallberg
Gesendet: Thursday, August 20, 2009 7:56 AM
An: r-help at r-project.org
Betreff: [R] How to extract row values?

Dear All!
I'm trying to extract one specific row from a data frame without columnnames
being included. I only want a 1-dimensional vector that consists of the
specific data on this row. Here's an example:
existing data:
column names: v1v2v3
Row 1             ab cd ef
Row 2             gh ij kl
Row 3             mn op qr
This is what I want to extract:
ab cd ef
I do not want: v1v2v3
                     ab cd ef
Thank you in advance

More information about the R-help mailing list