r - Subset columns in dataframe X based on columns of dataframe Y -
i subset x
data frame based in name collumns of y
dataframe:
my x
dataframe:
ne001 ne002 ne003 1 2 3
my y
dataframe:
ne001 ne003 10 5
my expected output:
ne001 ne003 1 3
any ideas? thank you! ps. subset collumn name, not collumn number.
this it:
x[,names(x) %in% names(y)]
perhaps want take closer @ r introduction text, see e.g. these r links.
Comments
Post a Comment