Re: [R] reshape a data frame

2015-06-04 Thread David L Carlson
Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter Sent: Thursday, June 4, 2015 8:58 AM To: javascriptart25 Cc: r-help@r-project.org Subject: Re: [R] reshape a data frame

Re: [R] reshape a data frame

2015-06-04 Thread Bert Gunter
Yes. This is basic stuff, and it seems unnecessary to run to packages for it, Knowledge of base R should suffice. It would appear that the OP would benefit by going through an R tutorial or two. Slightly more economical and more general -- and trickier -- than explicit concatenation, which could g

Re: [R] reshape a data frame

2015-06-03 Thread javascriptart25
You can change ex <- data.frame("gIN" = gIN, "bc1" = bc1, "bc2"=bc2, "group" = group) to ex <- data.frame("gIN" = c(gIN,gIN), "bcX" = c(bc1,bc2), "group" = c(group,group)) On Wed, Jun 3, 2015 at 2:27 PM, hedelhusk [via R] < ml-node+s789695n4708145...@n4.nabble.com> wrote: > Hello, > > I would

Re: [R] reshape a data frame

2015-06-03 Thread Jon BR
I found the gather function from the tidyr package, which worked nicely: gather(ex,bcX,value, bc1:bc2) gIN group bcX value 1 A_1 A bc1 1219.79 2 A_2 A bc1 1486.84 3 A_3 A bc1 1255.80 4 A_4 A bc1 941.87 5 B_1 B bc1 588.19 6 B_2 B bc1

Re: [R] reshape a data frame

2015-06-03 Thread John Kane
...@gmail.com > Sent: Wed, 3 Jun 2015 18:25:02 -0400 > To: r-help@r-project.org > Subject: Re: [R] reshape a data frame > > I found the gather function from the tidyr package, which worked nicely: > > gather(ex,bcX,value, bc1:bc2) >gIN group bcX value > 1 A_1