0

I have a dataset with over 1K variables. I would like to create a new data frame that transposes all variables into one column so I can better search through the variables. My intended result can be seen below. I do not need to have the observations included in the new DF.

Current Data

Var 1 | Var 2| Var 3| etc

The desired Outcome would be one variable column

Column

  • Var 1
  • Var 2
  • Var 3
Tyler Witt
  • 17
  • 5
  • Yes - this is typically called "reshaping" or "pivoting" data from wide to long - the linked FAQ gives several options. – Gregor Thomas Nov 09 '20 at 15:38
  • That would be appropriate if you want the corresponding values. If you just want the column names you can extract them with `names(your_data)`. Or put them in a data frame: `your_variables = data.frame(names(your_data))` – Gregor Thomas Nov 09 '20 at 15:39

0 Answers0