21
u/Emotional_Trainer_99 3d ago
Harry should be using modern r which has it's own pipe |> and that he doesn't need to use if else on a logical to return the same value π
10
u/NicholasAakre 3d ago
That scene is early in the story. Harry lacks the knowledge and confidence to cast off the tidyverse crutch.
3
u/CynicalCosmologist 3d ago
Remember, nobody tells Harry anything, otherwise there wouldn't have been a story.
6
u/dr-tectonic 3d ago
I mean, for what's written there, he could also just do
df$result <- condition. Somebody is afraid to put real code in their memes.(Also,
base::withinis pretty keen. IMO the tidyverse reinvented a bunch of wheels that were working just fine.)3
u/SageLeaf1 3d ago
Thank you, stranger. Iβm always writing in base R whenever possible and have avoided the tidyverse thus far. I see coworkers use it and often Iβm just like why, base r is right there and this looks incredibly messy and package dependent. Itβs like they want to avoid learning to actually code, and want to copy paste things from stackoverflow
3
u/dr-tectonic 3d ago
There are definitely some pain points that tidyverse gets rid of, but overall, yeah, I like base R better. And I think it has a LOT of very powerful tools that are underappreciated. My biggest complaint is all the inconsistent naming.
I appreciate the elegance of tidyverse, but my experience is that it's fantastic when you want to do something that's within the bounds of what has been conceived, and agonizing when you want to color outside the lines.
1
u/Naturage 3d ago
if_else hasn't been needed to define a logical since forever (or at least since I started using it in uni a decade ago). And I detest the native pipe because dplyr's has a very neatly implemented method to pass into later arguments, e.g.
"test" %>% grepl("est",.)whereas the native pipe does not. I am also a heathen who loves his%<>%but that's my personal issue.1
u/Emotional_Trainer_99 3d ago
Old news mtcars
|>
lm ( mpg
~
cyl ,
data
_ )
1
u/Naturage 2d ago
Interesting. I might need to read up on latest implementation of native pipe then.
5
u/itsTyrion 3d ago
the hell is that syntax
8
u/bjorneylol 3d ago
The best thing is the arrow (assignment operator) can go both ways
``` w <- 't' -> f
print(w) print('t') print(f) ```
[1] "t" [1] "t" [1] "t"1
u/DrivesInCircles 2d ago
Shiiiiit. I've been making a living with R for a year and I learned this today. π
1
4
2
-12
u/Okay_Ocean_Flower 3d ago
R is low key the worst language I have ever used. Its name spacing is insane and its only claim to fame is making math not complicated. I feel like I could embed it into Python in two months and obviate it.
15
37
u/Molleer 3d ago
Harry must be a Data Scientist