[R] subset range selections

jim holtman jholtman at gmail.com
Mon Jul 13 15:59:24 CEST 2009


1)   X <- subset(A, (t < 1000) | (t > 1200))
2)   X <- subset(A, (t > 1000) & (t < 1200))

On Mon, Jul 13, 2009 at 9:47 AM, Mark Knecht<markknecht at gmail.com> wrote:
> How would I write the two selections each in a single subset command?
>
> 1) Two non-overlapping time ranges I want to collect together - before
> 10AM and after noon. Should be an OR function:
>
> X = subset(A, t<1000)  + subset(A, t>1200)
>
> 2) One range between two defined times like after 10AM and before
> noon. Should be an AND function:
>
> X1 = subset(A, t>1000)
> X = subset(X1, t<1200)
>
> Thanks,
> Mark
>
> P.S. - The help system seems very difficult for finding this sort of
> information!
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list