knitr::opts_chunk$set(echo = TRUE) library(epiuf)
checkDico compares a number list to the contents of a variable, and flags a warning if the variable contains numbers not specified in the list Works with numeric, character and multi-input variables.
# create example dataset for testing df <- data.frame(checkbox_var = c("0|2", "1|2|3", "3|1|2", "0", "2", "3", "0|1", "2|3", NA_character_) ,number_var = c(0,1,2,3,0,1,2,3,NA_real_) ,character_var = c("0","1","nd","3","","1","2","3",NA_character_) )
checkDico(df, checkbox_var, c(0,1,2,3)) checkDico(df, number_var, c(0,1,2,3)) checkDico(df, character_var, c(0,1,2,3))
Expected output: nothing
checkDico(df, checkbox_var, c(0,1,2,3,4)) checkDico(df, number_var, c(0,1,2,3,4)) checkDico(df, character_var, c(0,1,2,3,4))
Expected output: nothing
checkDico(df, checkbox_var, c(0,1,2)) checkDico(df, number_var, c(0,1,2)) checkDico(df, character_var, c(0,1,2))
Expected output: [variable name] contains: 0 1 2 3 , Code is: 0 1 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.