> intersect(c(1,3,2),c('1','3')) [1] "1" "3" Apparently, intersect() treats num as string. But this is not documented in the help. Could somebody add it in the future version of R?
Also according to the help, the argument should not have duplicated elements. But I tried the following example, it seems that it doesn't matter where there are duplicated elements or not. Should the help be corrected? Or somebody could provide me with an example that make intersect() fails if there are duplicated elements? > x=c(3,1,2,1,7) > y=c(5,1,4,2,3,8,1) > x [1] 3 1 2 1 7 > y [1] 5 1 4 2 3 8 1 > intersect(x,y) [1] 3 1 2 ______________________________________________ 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.