[R] how to split data.frame by row?

Weiwei Shi helprhelp at gmail.com
Mon Oct 29 17:43:16 CET 2007


Thanks.

but I need to make it into a more general case instead of that example



On 10/29/07, Henrique Dallazuanna <wwwhsd at gmail.com> wrote:
> If I understand your question:
>
> df <- data.frame(x=rnorm(20), y=rnorm(20), z=rnorm(20))
> df <- as.matrix(df)
> dim(df)
> dim(df) <- c(10,6)
> dim(df) <- c(5,12)
>
> On 29/10/2007, Weiwei Shi <helprhelp at gmail.com> wrote:
> >
> > hi,
> >
> > if I have 20 x 3 data.frame, how to split it into
> > 10 x 6 (moving the lower part of 10x3 to column)
> >
> > or
> >
> > 5 x 12
> >
> > thanks
> >
> > --
> > Weiwei Shi, Ph.D
> > Research Scientist
> > GeneGO, Inc.
> >
> > "Did you always know?"
> > "No, I did not. But I believed..."
> > ---Matrix III
> >
> > ______________________________________________
> > 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


-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III



More information about the R-help mailing list