[R] Putting x into the right subset

From: John Wiedenhoeft <wiedenhoeft_at_gmx.net>
Date: Sat 22 Jul 2006 - 10:18:41 EST


Dear all,

I'm sorry I have to bother you with this newbie stuff.

Within a loop I obtain pairs of values x <- c(a, b). An empty set M is defined before the loop (as a list or whatever). Now I want to do the following: if there is a vector y in M that contains at least one of the values of x, then x shall be concatenated to y. If y doesn't contain any of the values in x, then x shall be put into M as a new vector. I first imagined it to be trivial but I'm having a hard time with the if-statement. I tried to define a function contains(value, vector), which returns FALSE or TRUE, but R complains that I tried to execute a "non-function"...

Could anybody help a despaired newbie, please!

Thanks a lot,
John



R-help@stat.math.ethz.ch 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 Sat Jul 22 10:24:24 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 22 Jul 2006 - 20:15:32 EST.

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