[R] subset range selections

Mark Knecht markknecht at gmail.com
Mon Jul 13 16:21:06 CEST 2009


Thanks Jim.

How does one search the help system for info on simple logic like this?

On Mon, Jul 13, 2009 at 6:59 AM, jim holtman<jholtman at gmail.com> wrote:
> 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