3 ms·
Interesting. I am happy assigning the traditional way but don't mind the idea of an assignment pipe. Personally, I still use the magrittr pipe because I prefer
by nomilk 3y ago
Interesting. I am happy assigning the traditional way but don't mind the idea of an assignment pipe. Personally, I still use the magrittr pipe because I prefer the syntax (and love the keyboard shortcut) to the base pipe.
The evidence section kinda lost me (what is `wardmap@data` supposed to be? - I'm not sure it's valid R code, and can't spot it on stack overflow as the article suggests?)
Small correction: under the bit about 'A simple syntax transformation converts .. into ..' the two should be the other way around.
- dash2 3y agowardmap@data is the data slot in the S4 object wardmap. A little advanced…
- nomilk 3y agoHadn't come across it. An assignment pipe should be a relatively easy sell since it produces more concise code, and lets the developer work left to right, top to bottom (how we all want to work), rather than having to backtrack to place `df <- ` at the start. I'd try demo it on super common use cases (so the average R user can easily see how coding patterns are improved by it). Found the Stack Overflow question: https://stackoverflow.com/q/34500567 https://stackoverflow.com/q/34500567 EDIT: came across a nice explanation of the S4 system [1] under the 'Overview' and 'Slots and accessor functions' sections. Seems it's commonly used in genetics and geospatial work. [1] https://kasperdanielhansen.github.io/genbioconductor/html/R_S4.html#:~:text=The%20S4%20system%20in%20R,also%20known%20as%20reference%20classes https://kasperdanielhansen.github.io/genbioconductor/html/R_...).
- dkga 3y agoYou can change the keyboard shortcut to the native R pipe in RStudio if you like. I did it just to avoid the dependency because truth be told the native pipe seems a bit ugly to me (but that’s just me)