Skip to content
Prev 172001 / 398503 Next

Filtering a dataset's columns by another dataset's column names

on 02/27/2009 11:27 AM Josh B wrote:
Same.Cols <- intersect(names(DF1), names(DF2))
[1] "Individual" "SNP1"       "SNP3"       "SNP5"
Individual SNP1 SNP3 SNP5
1          1    A    T    A
2          2    T    A    T
3          3    A    T    A
4          4    A    T    T
5          5    T    A    A
6          6    A    A    T


See ?intersect, which gives you the common column names, which you can
then use in rbind().

HTH,

Marc Schwartz