search for: common_order

Displaying 1 result from an estimated 1 matches for "common_order".

2010 Apr 22
2
Compare two data frames
...;- d1[, c('y', 'x')] The first dataframe d1 has more variables than d2 and the variable columns are in a different order. So, what I want to do is compare the two frames on the variables that are common between the two. First I find the common variables between the two dataframes common_order <- intersect(colnames(d1), colnames(d2)) Then, I have to put the variables in d2 in the same order as d1 as d2 <- d2[, common_order] Then, I keep only the variables in common between d1 and d2 as d1 <- d1[, common_order] Then, finally I can do the compare on the common variables now i...