Created
August 28, 2018 21:57
-
-
Save hadley/a4a74376e6809592f2486a96a3d2ffad to your computer and use it in GitHub Desktop.
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
ruler <- function(width = getOption("width")) { | |
x <- seq_len(width) | |
y <- dplyr::case_when( | |
x %% 10 == 0 ~ as.character((x %/% 10) %% 10), | |
x %% 5 == 0 ~ "+", | |
TRUE ~ "-" | |
) | |
cat(y, "\n", sep = "") | |
cat(x %% 10, "\n", sep = "") | |
} | |
ruler() | |
#> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+ | |
#> 123456789012345678901234567890123456789012345678901234567890123456789012345 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment