1

I'm trying to use reshape to convert from long to wide, and my timevar doesn't seem to be recognized appropriately. The time variable is Year; there are three idvars; and there is one variable (n) that I want under each Year once it's converted to wide format. However, Year is put into a single column with the col.name n.c("2005","2006","2007"). I've converted Year to numeric, integer, and character, and get a different version of wrong each time. My code is as follows:

wide_df <- reshape(df, timevar="Year", 
           idvar = c("Race","Category","Outcome"),
           direction = "wide")

Is there a formatting issue that I'm unaware of? Or could it be problematic that I've used group_by for some of the idvars in the data.frame from which df was derived?

ae0977
  • 11
  • 1
  • 5
    Can you provide your `df`, or small data representative of it at least? It's a bit hard to debug without having the data. – thelatemail Jun 11 '17 at 22:16
  • You can use `dput()` for that matter. Read following link to learn [How to provide a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – M-- Jun 11 '17 at 23:12

0 Answers0