Re: [R] Reorganize the data (dplyr or other packages?)

2020-08-17 Thread Hadley Wickham
> | but they won't receive any new > | features, and we believe that there > | are now better approaches to solving > | the same problem. > > Is tidyr::pivot_longer this better > solution? It is an easier to understand > version of the now retired and confusing > (for me) tidyr::gather which at

Re: [R] Reorganize the data (dplyr or other packages?)

2020-08-17 Thread Rasmus Liland
On 2020-08-17 10:09 -0700, Bert Gunter wrote: | On Mon, Aug 17, 2020 at 9:53 AM Rasmus Liland wrote: | | | | Also, stack is also possible to use: | | | | tab <- structure(list( | | date = c("2019M08", "2019M09", "2019M10"), | | down = c(0.01709827, 0.02094724, 0.01750911), | | uc =

Re: [R] Reorganize the data (dplyr or other packages?)

2020-08-17 Thread Bert Gunter
Well, not that there is anything "wrong" with previous suggestions, but it is pretty straightforward just with base R functionality: > nm <- names(tab)[2:4] > with(tab, data.frame(date = rep(date, length(nm)), + direction = rep(nm, e = 3), + percentage =

Re: [R] Reorganize the data (dplyr or other packages?)

2020-08-17 Thread Rasmus Liland
Dear John, Op ma 17 aug. 2020 om 09:52 schreef Eric Berger: | On Mon, Aug 17, 2020 at 10:49 AM Thierry Onkelinx wrote: | | | | You are looking for tidyr::pivot_longer() | | Alternatively, melt() from the reshape2 package. | | library(reshape2) |

Re: [R] Reorganize the data (dplyr or other packages?)

2020-08-17 Thread Hadley Wickham
We previously used the term retired to suggest that the package is taking it easy and relaxing, but isn't dead. This causes a lot of confusion so we now call this state "superseded" — we'll continue to keep reshape2 (and reshape!) on CRAN, but they won't receive any new features, and we believe

Re: [R] Reorganize the data (dplyr or other packages?)

2020-08-17 Thread Eric Berger
Thanks for this information Thierry. I was not aware. The author of the packages is Hadley Wickham. He writes on Github that he does plan to make changes necessary to keep the package available on CRAN. On Mon, Aug 17, 2020 at 11:23 AM Thierry Onkelinx wrote: > Yes. However reshape2 is a

Re: [R] Reorganize the data (dplyr or other packages?)

2020-08-17 Thread John
Thanks! Thierry Onkelinx 於 2020年8月17日 週一 下午4:23寫道: > Yes. However reshape2 is a retired package. The author recommends to use > his new package tidyr. > > ir. Thierry Onkelinx > Statisticus / Statistician > > Vlaamse Overheid / Government of Flanders > INSTITUUT VOOR NATUUR- EN BOSONDERZOEK /

Re: [R] Reorganize the data (dplyr or other packages?)

2020-08-17 Thread Thierry Onkelinx via R-help
Yes. However reshape2 is a retired package. The author recommends to use his new package tidyr. ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie &

Re: [R] Reorganize the data (dplyr or other packages?)

2020-08-17 Thread Eric Berger
Alternatively, melt() from the reshape2 package. library(reshape2) melt(x,id.vars="date",measure.vars=c("down","uc","up"),variable.name ="direction",value.name="percentage") HTH, Eric On Mon, Aug 17, 2020 at 10:49 AM Thierry Onkelinx via R-help < r-help@r-project.org> wrote: > You are looking

Re: [R] Reorganize the data (dplyr or other packages?)

2020-08-17 Thread Thierry Onkelinx via R-help
You are looking for tidyr::pivot_longer() Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality