[R] Data frame organization

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Tue Aug 27 00:28:28 CEST 2019


Hi Arnaud,
The reason I wrote the following function is that it always takes me
half a dozen tries with "reshape" before I get the syntax right:

amdf<-read.table(text="A   10
B   5
C   9
A   5
B   15
C   20")
library(prettyR)
stretch_df(amdf,"V1","V2")
 V1 V2_1 V2_2
1  A   10    5
2  B    5   15
3  C    9   20

Jim

On Tue, Aug 27, 2019 at 4:06 AM Arnaud Mosnier <a.mosnier using gmail.com> wrote:
>
> Hi,
>
> I have a really simple question.
> I need to convert a data.frame with the following format
>
> A   10
> B   5
> C   9
> A   5
> B   15
> C   20
>
> in this format
>
> A   10   5
> B   5    15
> C   9    20
>
> Thanks !!!
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list