[R] Extracting a dataframe column as a dataframe

Dimitri Shvorob dimitri.shvorob at gmail.com
Sat Dec 25 20:30:48 CET 2010


> x = structure(list(time = structure(c(1020232904.818, 1020232904.818
), class = c("POSIXt", "POSIXct"), tzone = ""), price = c(321, 
323.5)), .Names = c("time", "price"), row.names = 1:2, class = "data.frame")
> x1 = x[,c("price")]
> dput(x1)
c(321, 323.5)

Is there similar syntax that gets "price" as a (single-column) dataframe? (I
know that I can use "subset(... select = ...)")..
Thank you. 
-- 
View this message in context: http://r.789695.n4.nabble.com/Extracting-a-dataframe-column-as-a-dataframe-tp3163920p3163920.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list