Created
August 1, 2017 11:44
-
-
Save MikeMKH/401feca0b58945ba12cc61d7d38f66a2 to your computer and use it in GitHub Desktop.
FizzBuzz kata as a tibble from tidyverse
This file contains hidden or 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
library(tidyverse) | |
fb <- tibble( | |
x = 1:100, | |
fizzable = ifelse(x %% 3 == 0, TRUE, FALSE), | |
buzzable = ifelse(x %% 5 == 0, TRUE, FALSE), | |
formatted = ifelse(fizzable & buzzable, "FizzBuzz", | |
ifelse(fizzable, "Fizz", | |
ifelse(buzzable, "Buzz", | |
x))) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment