search for: nameswid

Displaying 4 results from an estimated 4 matches for "nameswid".

Did you mean: nameswide
2023 Apr 03
4
Simple Stacking of Two Columns
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 NamesLong<-data.frame(Names=c("Tom","Dick","Larry","Curly")) > NamesLong Names 1 Tom 2 Dick 3 Larry 4...
2023 Apr 04
1
Simple Stacking of Two Columns
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.f...
2023 Apr 03
1
Simple Stacking of Two Columns
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' values), which tells you which column in the source data frame the stacked values originated from. Thus, if you just want the actual data: > stac...
2023 Apr 04
1
Simple Stacking of Two Columns
...----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Heinz Tuechler Sent: Monday, April 3, 2023 4:39 PM To: r-help at r-project.org Subject: Re: [R] Simple Stacking of Two Columns 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" <jspark4 at uic.edu> wrote: &...