[R] Extracting a dataframe column as a dataframe
Phil Spector
spector at stat.berkeley.edu
Sat Dec 25 23:00:57 CET 2010
> x['price']
price
1 321.0
2 323.5
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spector at stat.berkeley.edu
On Sat, 25 Dec 2010, Dimitri Shvorob wrote:
>
>> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list