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
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))
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
.@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
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
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
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
>
, 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
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'
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
>
>
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
11 matches
Mail list logo