-
-
Save wlinInspire/d80a9ed491be9e1178a560d095170e79 to your computer and use it in GitHub Desktop.
10 R Functions to Boost Your Productivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lw <- function(v) { | |
if (sum(v, na.rm = TRUE) == 0) { | |
1 / length(v) | |
} else { | |
v / sum(v, na.rm = TRUE) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment