From: Jonathan Baron (baron@cattell.psych.upenn.edu)
Date: Sat 29 Jun 2002 - 02:29:45 EST
Message-id: <20020628122945.A10274@cattell.psych.upenn.edu>
On 06/28/02 17:57, Patrick Hausmann wrote:
>Hello,
>
>I would like to switch this dataframe:
>> k
> country 1960 1961 1962 1963
>99 ARG 7493 7733 7581 7108
>246 AUS 10484 10342 10809 11357
>295 AUT 7438 7808 7938 8212
>393 BDI 587 502 555 608
>442 BEL 8223 8638 9021 9311
>
>in this structure:
>
>year ARG AUS AUT BDI BEL
>1960 7493 10484 7438 587 8223
>1961 7733 10342 7808 502 8638
>1962 7581 10809 7938 555 9021
>1963 7108 11357 8212 608 9311
>
>I'm trying the 'reshape' and 't' command, but still failed.
t() likes to have a matrix, not a data frame. So you can say
something like
as.data.frame(t(as.matrix(data.frame(MY.DATA.FRAME))))
-- Jonathan Baron, Professor of Psychology, University of Pennsylvania R page: http://finzi.psych.upenn.edu/ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:34 EST