[R] Subset function
Rainer Schuermann
rainer.schuermann at gmx.net
Fri Sep 9 14:44:11 CEST 2011
Does that help:
> x
xin xout
1 1 14
2 8 5
3 16 884
4 1 14
5 8 5
6 16 884
> subset( x, x$xin > 7, select = xout )
xout
2 5
3 884
5 5
6 884
Rgds,
Rainer
On Friday 09 September 2011 04:38:44 stat.kk wrote:
> Hi,
>
> can anyone help me how to use 'subset' function on my data frame?
> I have created data frame 'data' with a few variables and with row names.
> Now I would like to subset rows with concrete row names.
> Using data[] I know how to do it. But I dont know how to formulate the
> subset condition:
> subset(data, subset = ?, select = c(var1, var2))
>
> Thank you very much,
> stat.kk
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Subset-function-tp3801397p3801397.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