I am working with a large dataset on country level data that is in country-year format and appears in the following form (abridged for ease):

```
Country     Variable of Interest  Year
Bolivia     5                     1990
Bolivia     6                     1991
Bolivia     7                     1992
Cambodia    8                     1990
Cambodia    9                     1991
Cambodia    10                    1992
Russia      11                    1990
Russia      12                    1991
Russia      13                    1992

```

Due to a collaboration with a colleague, how do I get the data into this form?:

```
Country   1990    1991   1992
Bolivia    5        6     7
Cambodia   8        9     10
Russia     11       12    13

```

I'm using R version 2.15.2 and using the library WDI to poll the World Bank for the information. I'm attaching my code as it stands so far that will work for a single country. I will then paste the code when I try to do it for all countries. Any help would be greatly appreciated. Thanks.

```
library(WDI)
x<-WDI(country="US",indicator="NY.GDP.MKTP.CD",start = 1980, end=2012)
a<-as.matrix(x$country)
b<-x$year
x<-as.data.frame(t(x))
colnames(x)<-b
x<-x[-1:-2,][-2,]
x<-x[,order(ncol(x):1]
a<-a[1,]
rownames(x)<-a
x

```

The change for when I try to change to all countries is changing the argument "US" to "all" in WDI.

I appreciate any and all help on this! Thank you in advance!