Re: [R] Simple Stacking of Two Columns

2023-04-04 Thread Ebert,Timothy Aaron
561.863 c a5 581.989 c a6 6371.465e a7 552.208 c -Original Message- From: R-help On Behalf Of Richard O'Keefe Sent: Tuesday, April 4, 2023 8:21 AM To: Sparks, John Cc: r-help@r-project.org Subject: Re: [R] Simpl

Re: [R] Simple Stacking of Two Columns

2023-04-04 Thread Richard O'Keefe
Just to repeat: you have NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly")) and you want NamesLong<-data.frame(Names=c("Tom","Dick","Larry","Curly")) There must be something I am missing, because NamesLong <- data.frame(Names = c(NamesWide$Name1, NamesWide$Name2))

Re: [R] Simple Stacking of Two Columns

2023-04-04 Thread Kimmo Elo
frame(append(c1,c2)) if you want that form. > > Tim > > -Original Message- > From: R-help On Behalf Of Marc > Schwartz via R-help > Sent: Monday, April 3, 2023 11:44 AM > To: Sparks, John ; r-help@r-project.org > Subject: Re: [R] Simple Stacking of Two Columns

Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread Ebert,Timothy Aaron
.@gmail.com Sent: Monday, April 3, 2023 9:28 PM To: 'Heinz Tuechler' ; r-help@r-project.org Subject: Re: [R] Simple Stacking of Two Columns [External Email] I may be missing something but using the plain old c() combine function seems to work fine: df <- data.frame(left = 1:5, right = 6:10) df.c

Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread avi.e.gross
comb 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 -Original Message- From: R-help On Behalf Of Heinz Tuechler Sent: Monday, April 3, 2023 4:39 PM To: r-help@r-project.org Subject: Re: [R] Simple Stacking of Two Columns Jeff Newmiller wrote/hat geschrieben

Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread Heinz Tuechler
Jeff Newmiller wrote/hat geschrieben on/am 03.04.2023 18:26: unname(unlist(NamesWide)) Why not: NamesWide <- data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly")) NamesLong <- data.frame(Names=with(NamesWide, c(Name1, Name2))) On April 3, 2023 8:08:59 AM PDT, "Sparks, John" wrote: Hi

Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread Jeff Newmiller
unname(unlist(NamesWide)) On April 3, 2023 8:08:59 AM PDT, "Sparks, John" wrote: >Hi R-Helpers, > >Sorry to bother you, but I have a simple task that I can't figure out how to >do. > >For example, I have some names in two columns >

Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread Ebert,Timothy Aaron
, John ; r-help@r-project.org Subject: Re: [R] Simple Stacking of Two Columns [External Email] Hi, You were on the right track using stack(), but you just pass the entire data frame as a single object, not the separate columns: > stack(NamesWide) values ind 1Tom Name1 2 Dick Name1 3 La

Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread Marc Schwartz via R-help
Hi, You were on the right track using stack(), but you just pass the entire data frame as a single object, not the separate columns: > stack(NamesWide)   values   ind 1    Tom Name1 2   Dick Name1 3  Larry Name2 4  Curly Name2 Note that stack also returns the index (second column of 'ind'

Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread Eric Berger
pivot_longer() Sent from my iPhone > On 3 Apr 2023, at 18:09, Sparks, John wrote: > > Hi R-Helpers, > > Sorry to bother you, but I have a simple task that I can't figure out how to > do. > > For example, I have some names in two columns > >

[R] Simple Stacking of Two Columns

2023-04-03 Thread Sparks, John
Hi R-Helpers, Sorry to bother you, but I have a simple task that I can't figure out how to do. For example, I have some names in two columns NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly")) and I simply want to get a single column