Dear all,
  I have two vectors x and y, both of which are of length 1000.
I created a factor as.factor(rep(1:100,each=10)).
  Now I want  to count, for each factor level, the number of intersections
between x and y. In other words, I would like to count the number of
intersections between x[1:10] and y[1:10], the number of
intersections between x[11:20] and y[11:20], the number of
intersections between x[21:30] and y[21:30] and so on.
I know I could use the match function or the "%in% " function in a loop,
but would rather use some simpler way to do this, for example using tapply.
  Can anyone give a hint? Thanks a lot.
    Hanna

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to