Skip to content

Instantly share code, notes, and snippets.

@PatrickRWright
Created May 8, 2020 14:21
Show Gist options
  • Save PatrickRWright/f0eb65f90fdcae1002432a475b31a188 to your computer and use it in GitHub Desktop.
Save PatrickRWright/f0eb65f90fdcae1002432a475b31a188 to your computer and use it in GitHub Desktop.
Created on Skills Network Labs
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PatrickRWright
Copy link
Author

PatrickRWright commented May 8, 2020

Original comment in older gist by @DrEspresso:
Careful, the right hand side in case_when needs to be of the same data type! E.g. if you want to return NA for all other cases, you need to specify TRUE ~ NA_integer_, as NA is of type logical and will throw an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment