Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread Ebert,Timothy Aaron
Combined, the answers are close to an example in the documentation for microbenchmark where they (in part) look at execution times for c() versus append(). Here is the code, but c() has the shortest execution time in this example. If I remove a3 and a4 then c() is significantly shorter than appe

Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread avi.e.gross
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.combined <- data.frame(comb = c(df$left, df$right)) df left right 11 6 22 7 33 8 44 9 5510 df.combined comb 1

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] Should help of estimate in t.test be corrected?

2023-04-03 Thread Ebert,Timothy Aaron
IMHO The difference makes sense for paired samples. For unpaired samples it is just the difference in means. I think presenting the means (and assuming the audience can perform subtraction) conveys more information. The interpretation of a difference of 5 might be influenced if I have means of -

Re: [R] Should help of estimate in t.test be corrected?

2023-04-03 Thread Samuel Granjeaud IR/Inserm
Hi Thanks for your feedback. I didn't think about that. Still, the mean difference is computed for paired, not because there are two samples. IMHO, the help should be updated. Best, Samuel Le 2023-04-03 à 12:10, PIKAL Petr a écrit : Hi You need to use paired option t.test(x=0:4, y=sample

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 > >NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Cu

Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread Ebert,Timothy Aaron
My first thought was pivot_longer, and stack() is new to me. How about append(c1,c2) as another solution? Or data.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

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' value

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 > > NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2

[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 NamesLong<-data.frame(Names=c("Tom","Dick",

Re: [R] Should help of estimate in t.test be corrected?

2023-04-03 Thread PIKAL Petr
Hallo, you are probably right that "the estimated mean or difference in means depending on whether it was a one-sample test or a two-sample test" should be rephrased to "the estimated mean or difference in means depending on whether it was a one-sample test, two-sample test or two sample pai

Re: [R] seqMK function

2023-04-03 Thread Rasmus Liland
Dear Nick, Looking at dput(pheno::seqMK), dput(pheno::tau), and [1], I think you need to change the function pheno::tau to change the confidence level ... R [1] https://mannkendall.github.io/about.html#application-of-the-seasonal-mann-kendall-test

Re: [R] Should help of estimate in t.test be corrected?

2023-04-03 Thread PIKAL Petr
Hi You need to use paired option > t.test(x=0:4, y=sample(5:9), paired=TRUE)$estimate mean difference -5 Cheers Petr > -Original Message- > From: R-help On Behalf Of Samuel Granjeaud > IR/Inserm > Sent: Sunday, April 2, 2023 11:39 PM > To: r-help@r-project.org > Subject: [

[R] Should help of estimate in t.test be corrected?

2023-04-03 Thread Samuel Granjeaud IR/Inserm
Hi, Not important, but IMHO the estimate component of the t.test holds an estimate of mean of each group, never a difference. The doc says "estimate    the estimated mean or difference in means depending on whether it was a one-sample test or a two-sample test." > t.test(0:4)$estimate mean o