Pascal A. Niklaus wrote:

   y <- c("a","b","c")
   if("a" in y)
   {
         # "a" is not in y
   }

You are 98% of the way there. The missing two percent is this:


 if("a" %in% y) {
...
}

you could also use the 'any' function:

 if(any(y=="a")){
...
 }


Also, is there a way to generate character sequences similar to numeric sequences, e.g. something like "A":"J" ? I remember having seen a command doing this somewhere, but can't find it anymore

R defines two vectors, "letters" and "LETTERS" which have the 26 lower and upper-case letters of the English alphabet. Subset from them to get what you want.


Baz

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to