[R] data.frame - transform
Patrick Hausmann
patrick.hausmann at uni-bremen.de
Fri Jun 14 10:36:17 CEST 2002
Hi there,
I have a data.frame (pwt6) which I would like to transform:
country year gdp
MEX 1950 2
MEX 1951 5
BOL 1950 4
BOL 1951 12
ITA 1950 45
ITA 1951 2
This should be the result:
year MEX.gdp BOL.gdp ITA.gdp
1950 2 4 45
1951 5 12 2
Right now I have this code (better - no code):
country.label<-names(table(pwt6$country))
result<-data.frame(year=NULL)
for(i in country.label)
?
Thanks for any help,
Patrick
-------------
Patrick Hausmann
Friedrich-Wilhelm Str. 37 - D-28199 Bremen
Tel. +49 421 5980631 - Fax. +49 421 5980632
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list