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 xdataframe:

ne001   ne002   ne003   1       2       3 

my ydataframe:

 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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -