[R] Getting only label column of a data frame

Gundala Viswanath gundalav at gmail.com
Mon Jun 23 04:16:05 CEST 2008


Hi,

How can I extract the label only from a given data frame.

Fore example from this data frame.

> print(dataf)
          V1      V2      V3      V4      V5      V6      V7      V8      V9
11145    14.3    17.1    31.2    41.7    45.8    49.8    68.6    70.6    72.9
3545     10.2    15.6    20.9    23.2    31.4    31.7    36.2    48.4    51.9
8951     15.2    17.5    20.0    21.4    32.4    49.7    51.3    58.3    58.9
11097    59.5    65.9   117.5   118.0   118.9   122.5   126.3   156.5   157.0

I want to get the label (first) column only:

11145
3545
8951
11097

Is there a quick way to achieve that?
I tried this but fail:

mylable <- dataf[,1]

Please advice.

- Gundala Viswanath
Jakarta - Indonesia



More information about the R-help mailing list