Skip to content

Instantly share code, notes, and snippets.

@MikeMKH
Created August 1, 2017 11:44
FizzBuzz kata as a tibble from tidyverse
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