How to use a character vector of column names in the formula argument of dcast (reshape2)
问题 Say I have a dataframe df with dozens of identifying variables (in columns) and only a few measured variables (also in columns). To avoid repetitively typing all the variables for each argument, I assign the names of the identifying and measured df columns to df_id and df_measured , respectively. It's easy enough to input these vectors to shorten the argument inputs for melt ... df.m <- melt(df, id.vars = df_id, measure.vars = df_measured) ... but I'm at a loss for how to enter the formula =