I have two dataframes:
df1<-matrix(data = 1:10,
nrow = 5,
ncol = 5)
colnames(df1)=c("a","b","c","d","e")
df2=c("a","c","e")
I want to create a new table using the values from the first data frame but including only the columns whose name is present in the second data frame.