I have a list of 100 columns in a data frame Data1. One of these variables is the dependent variable. The others are predictors.
I need to extract 99 predictors into a column (say varlist
) to be used in the equation below
equation <- as.formula(paste('y', "~", paste(varlist, collapse="+"),collapse=""))
I can use dput
on the dataframe to extract all the columns but I could not get rid of the dependent variable y from the list:
Varlist <- dput(names(Data1))