Reputation: 57
I would like to check which Cols are extra in the first DF but not visible in the second.
Do we have any function in dplyr perhaps which could help? It would be nice if this could list out the column names only which are surplus.
Upvotes: 0
Views: 98
Reputation: 388982
We can use setdiff
setdiff(names(df1), names(df2))
#[1] "b" "c"
data
df1 <- data.frame(a = 1:5, b = 6:10, c = 12:16)
df2 <- data.frame(a = 11:15)
Upvotes: 2