[R] an operator for "contains"
Thomas Lumley
tlumley at u.washington.edu
Fri Jun 17 22:47:55 CEST 2005
On Fri, 17 Jun 2005, Mike R wrote:
> k = c(1:9)
> if( length( which(k==3) ) ){ print("contained") }else{ print("not contained") }
>
> is therre a simple way to test if a vector/list contains a particular value?
value %in% vector
> more generally, is the a documentaion page that lists/describes all
> such operators?
No. You can find binary operators fairly effectively by looking at the
html help, because they have to have non-alphabetic names (either single
characters or beginning and ending with %).
However, there are functions such as setdiff() that you might think of as
binary operators that you wouldn't find this way.
-thomas
More information about the R-help
mailing list