Skip to content
Prev 385341 / 398513 Next

combine filter() and select()

Inline

----- Original Message -----
I would write 

mytbl %>%
  filter(grepl("a", files)) %>%
  select(files) -> myfile

as I like to keep a sort of "top to bottom and left to right" flow when writing in the tidyverse dialect of R but that's really not important.

Apart from that I think what you've done is "proper tidyverse". To me another difference between the dialects is that classical R often seems to put value on, and make it easy, to do things with incredible few characters.  I think the people who are brilliant at that sort of coding, and there are many on this list, that sort of coding is also easy to read.  I know that Chinese is easy to read if you grew up on it but to a bear of little brain like me, the much more verbose style of tidyverse repays typing time with readability when I come back to my code and, though I have little experience of this yet, when I read other poeple's code.

What did you think wasn't "easy" about what you wrote?

Very best (all),

Chris