Anyone have any fun R things they've learned recently?

Holy moly thank you for bringing this up, @dylanjm, because I just tried out compose() for the first time and realized that you can use it to easily say the opposite of %in%

library(purrr)
  
`%in%`(3, c(1, 2, 3))
#> [1] TRUE

not_in <- compose("!", `%in%`)

not_in(3, c(1, 2, 3))
#> [1] FALSE

not_in(4, c(1, 2, 3))
#> [1] TRUE

Created on 2019-01-17 by the reprex package (v0.2.1.9000)

7 Likes