Files Corresponding to Short Course Programming in R
FizzBuzz is a common programming problem https://en.wikipedia.org/wiki/Fizz_buzz used to practice if statements and division.
For our version, create a vector test_vec
of the numbers 1 to 50
(1:50
). Then apply the following rules using dplyr::if_else
statements to obtain the appropriate behavior:
as.character()
)Notes:
%%
will give the remainder or a division (for instance 15 %% 3
is
0 and 16 %% 3
is 1). You can use this function and check if the
remainder is 0.