# construct data ---------------------------------------------------------------
# idx: 1 2 3 4 5 6 7 8 9 10 11 12 13
# -----------------------------------------------------------------------
id <- c("a", "a", "a", "b", "b", "b", "c", "d", "d", "d", "d", "d", "e")
target <- c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 4L, 4L, 4L, 4L, 4L, 5L)
# begin testing ----------------------------------------------------------------
test_id_map <- function() {
checkIdentical(1L, get_id_map(99))
checkIdentical(target, get_id_map(id))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.