I can't believe I just found out about magrittr::extract()
and magrittr::extract2()
. Super cool (and pipeable) functions! They make my code look waaaaay nicer.
EX:
library(tidyverse)
library(magrittr)
mylist <- list("this", "is", "pretty", "cool")
mylist[[3]]
#> [1] "pretty"
mylist %>% magrittr::extract2(3)
#> [1] "pretty"
Created on 2018-05-27 by the reprex package (v0.2.0).