2 Matching Annotations
- Jan 2020
-
jrnold.github.io jrnold.github.io
-
Write a function that turns (e.g.) a vector c("a", "b", "c") into the string "a, b, and c". Think carefully about what it should do if given a vector of length 0, 1, or 2.
Can we the whole code replace with: ifelse(length(x)==1, x, str_c(str_c(x[-length(x)], collapse = ", ")," and ",str_c(x[length(x)], collapse = ",")))
of course in the form of a function
-
-
jrnold.github.io jrnold.github.io
-
Distribution of last digit
Why we do that? Just to see if each digit appears or what? Thanks
-