3 ms·
This was fun to play around with. I made some very minor changes and posted at https://gist.github.com/hadley/d54895557fbb0fe0402d2277b901120a https://gist.gith
by hadley 5y ago
This was fun to play around with. I made some very minor changes and posted at https://gist.github.com/hadley/d54895557fbb0fe0402d2277b901120a https://gist.github.com/hadley/d54895557fbb0fe0402d2277b9011....
It revealed to me that there's a buglet in `forcats::last()` (https://github.com/tidyverse/forcats/issues/303 https://github.com/tidyverse/forcats/issues/303) and made me wonder if `pivot_longer()` should be able to rename the columns as you pivot them (https://github.com/tidyverse/tidyr/issues/1338 https://github.com/tidyverse/tidyr/issues/1338)
- dm319 5y agoThis might be the most excited I've gotten about a comment in hackernews for a while! So interesting to see your style of code (I was actually on 4.0 so gave me the impetus to upgrade to get the new pipes). fct_reorder - what a hugely useful function I didn't know about. The chicks vignette was nicely illustrative. And label_date_short also super useful. Also curious generally about your bracket style (I just tend to pile them all up when closing, which is something I only do in R and probably shouldn't!). Renaming factors is one of those things that always seems a bit awkward. I think I've used several methods. Passing a list of named vectors into `levels(x)` allows a many-to-one mapping but was quite dangerous. I've used revalue and mapvalues from plyr. fct_recode is new to me. But yes, renaming while reshaping could be quite convenient. Just looking at fct_recode now, it looks really nice. Seems to support many-to-one and being able to pass it a name vector is very convenient. Learnt so much today, and this is even before trying out the python and julia examples! Many thanks for this and all your work in R!
- pbowyer 5y agoIf you enjoyed this you might like https://github.com/VictimOfMaths/COVID-19 https://github.com/VictimOfMaths/COVID-19 :)