[R] Subsetting Data Frame based On Specified K Value

Gundala Viswanath gundalav at gmail.com
Thu Sep 3 08:44:16 CEST 2009


I have a data that looks like this:
http://dpaste.com/88988/plain/

How can I extract/subset the data frame
based on selected uniq ID.

Let's say I want the first K uniq ID.
I want to be able to specify the parameter "K" here,
(i.e. given K=3, we hope to extract dat$V2 = 0,1,2).

I'm stuck with this construct:

dat <- read.table("http://dpaste.com/88988/plain/")
dats <- subset(dat, V2 = ....)

- G.V.




More information about the R-help mailing list