Mount-Hood-Environmental / DASH

R Package Companion to the Drone Assisted Stream Habitat (DASH) Protocol
Other
3 stars 0 forks source link

Replace one_of() with any_of() or all_off() #19

Closed mackerman44 closed 3 years ago

mackerman44 commented 3 years ago

Low priority.

If I get a wild hair, consider replacing one_of() with any_of() or all_of(). First, need to determine if one_of() can universally be replaced with any_of(). What does all_of() replace?

KevinSee commented 3 years ago

I think the difference is that any_of() will grab any of columns you list. If you misspell one, it'll just skip that one (won't grab any column). all_of() will return an error if that happens.

At least that's my impression reading over the tidyverse help pages.

mackerman44 commented 3 years ago

So it seems going to all_of() would be the safer bet? At least in this case where I would likely do a find & replace?

KevinSee commented 3 years ago

Yes, all_of() will tell you when things have gone wrong, so then we can go in and fix them. any_of() will work, we just might not realize it didn't work as well as we had hoped.

mackerman44 commented 3 years ago

I replaced one_of() with all_of() in all functions where it was present. Tested all functions where a replacement was made and all seem to be working just fine.

Considering closed.