[R] the opposite of pluck() in purrr

Christopher W. Ryan cry@n @end|ng |rom b|ngh@mton@edu
Thu Nov 18 22:40:14 CET 2021


I've just learned about pluck() and chuck() in the purrr package. Very
cool!  As I understand it, they both will return one element of a list,
either by name or by [[]] index, or even "first"  or "last"

I was hoping to find a way to return all *but* one specified element of
a list. Speaking loosely, pluck(-1) or pluck(!1) or !pluck(1), but none
of those of course work. Thinking of English language, I had hopes for
chuck(1) as in "chuck element 1 away, leaving the rest"  but that's now
how it works.

Any tidyverse-centric ways to return all except one specified element of
a list?

Thanks.

--Chris Ryan



More information about the R-help mailing list