Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save timcdlucas/a20009632ac48b2ad086d4026c309ab1 to your computer and use it in GitHub Desktop.
Save timcdlucas/a20009632ac48b2ad086d4026c309ab1 to your computer and use it in GitHub Desktop.
psum function
x <- c(NA, 5:1)
y <- c(5:1, NA)
psum <- function(x, y){
x[is.na(x)] <- 0
y[is.na(y)] <- 0
x + y
}
psum(x, y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment