Is there a clearer, simpler, more direct, shorter way to do this:
Where df1 is a dataframe:
names(df1[grep(\"Yield\",names(df1))])
I wa
You could easily define your own function to make it shorter. For instance,
myfun <- function(x,y) names(y[grep(x, names(y))])
Then, whenever you need it, you use
myfun("Yield", df1)
It hardly gets any shorter.