now that the semester's over I can go back to the beligatured Fira Code for my main programming font #rstats

Follow

@andrew
Oh, speaking of R and ligatures, R's pipes are awesome, though the choice of infix operator notation isn't as much 😂

Relatedly, I have to plug both the purrr library for much nicer mapping (and reducing) functions than the built in lapply/sapply/mapply, and the different pipes that many people don't frequently discuss from magrittr! My second favorite is actually the "T pipe", which lets you call void functions that produce side-effects, without terminating the pipe prematurely (oh, and the '.' argument placeholder so you can repeat inputs in multiple locations of subsequent functions)!

For example, you can make a neat plot, and do some analysis on the dataframe/matrix after the plot in one go:

csums<-rnorm(100) %>%
matrix(ncol = 2) *%T>%*
plot %>%
colSums

Voila! You get your plot and your variable assignment in one, without code duplication! And of course, if you already knew all of this, please ignore me, but I love playing code golf 😅

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.