I have a long dataset like this:
Currency Year Percentage
<chr> <chr> <dbl>
1 PEN 2009 0.630
2 PEN 2010 0.584
3 PEN 2011 0.618
4 PEN 2012 1.03
5 PEN 2013 1.00
6 PEN 2014 1.05
and I would like to reshape it into wide direction such that currency is the time variable.
reshape(peru, direction = "wide", idvar = "Year", v.names = "Percentage",
timevar = "Currency")
But this code got me:
Year `Percentage.c("PEN", "USD", "EURO", "Other")`
<chr> <dbl>
1 2009 NA
2 2010 NA
3 2011 NA
4 2012 NA
5 2013 NA
6 2014 NA
Why did everything change into NA and why is my time variable not separated into "PEN", "USD", "EURO" and "Other"? I was expecting there to be 4 different variables: Percentage.PEN, Percentage.EURO, Percentage.USD and Percentage.Other.