[R] A question about data frame

Gang Chen gangchen6 at gmail.com
Thu Mar 10 22:35:30 CET 2011


A very simple question. With a data frame like this:

> n = c(2, 3, 5)
> s = c("aa", "bb", "cc")
> df = data.frame(n, s)

I want df$s[1] or df[1,2], but how can I get rid of the extra line in
the output about the factor levels:

> df$s[1]
[1] aa
Levels: aa bb cc

Thanks,
Gang



More information about the R-help mailing list