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?