Re: [R] is there something like or() ?

From: Moshe Olshansky <m_olshansky_at_yahoo.com>
Date: Mon, 7 Jan 2008 17:47:16 -0800 (PST)


You can say

table1$var2 %in% c("a","b","c","d")

> hi, this may be trivial, but we can't seem to find
> anything adequate,
> (although there is a work around with match() ). We
> are looking for something
> along the lines of
>
>
plot(table1[table1$var2==or("a","b","c","d"),"var1"])
>
>
> would be handy, with the potential or() function
> leading to what
>
> plot(table1[table1$var2=="a" | table1$var2=="b" |
> table1$var2=="c" |
> table1$var2=="d","var1"])
>
> would do.
> thanks for any hint
>
>
> ----------------------------------------------
> Dr. Sebastian Leuzinger
> University of Basel, Department of Environmental
> Science
> Institute of Botany
> Schönbeinstr. 6 CH-4056 Basel
> ph 0041 (0) 61 2673511
> fax 0041 (0) 61 2673504
> email Sebastian.Leuzinger_at_unibas.ch
> web http://pages.unibas.ch/botschoen/leuzinger
>
> ______________________________________________
> 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.
>



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. Received on Tue 08 Jan 2008 - 01:51:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Jan 2008 - 02:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive