Re: [R] transposition problem

From: Geoff Russell <geoffrey.russell_at_gmail.com>
Date: Wed, 16 Apr 2008 20:58:33 +0930

Many thanks -- the "unname" makes all the difference.

Geoff.

On 4/16/08, Henrique Dallazuanna <wwwhsd_at_gmail.com> wrote:
> Try this:
>
> x <- read.table(textConnection("\"1989-90\",\"1990-91\"
> Barley,23,34
> Oats,15,16"), sep = ",", header = T, check.names = FALSE)
>
> t(x)
>
> or if you want year as column and not rownames:
>
> data.frame(Year = names(x), t(unname(x)))
>
>
>
> On Wed, Apr 16, 2008 at 7:27 AM, Geoff Russell <geoffrey.russell_at_gmail.com>
> wrote:
>
> >
> > Hi use Rs,
> >
> > I have a csv file:
> >
> > "1989-90","1990-91"
> > Barley,23,34
> > Oats,15,16
> >
> > Which I want to turn into:
> > year, Barley, Oats
> > 1 "1989-90", 23, 15
> > 2 "1990-91",34,16
> >
> > Transpose doesn't quite do it, is there a standard way?
> >
> > Cheers,
> >
> > Geoff Russell
> >
> > ______________________________________________
> > R-help_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O

-- 
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 16 Apr 2008 - 11:31:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Apr 2008 - 12:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive