# NOT RUN {
data(testData)
data(toyData)
check(toyData)
 
# }
# NOT RUN {
DF <- data.frame(x = 1:15)
makeDataReport(DF)
# }
# NOT RUN {
# }
# NOT RUN {
data(testData)
makeDataReport(testData)
# }
# NOT RUN {
# Overwrite any existing files generated by makeDataReport
# }
# NOT RUN {
makeDataReport(testData, replace=TRUE)
# }
# NOT RUN {
# Change output format to Word/docx:
# }
# NOT RUN {
makeDataReport(testData, replace=TRUE, output = "word")
# }
# NOT RUN {
# Only include problematic variables in the output document
# }
# NOT RUN {
makeDataReport(testData, replace=TRUE, onlyProblematic=TRUE)
# }
# NOT RUN {
# Add user defined check-function to the checks performed on character variables:
# Here we add functionality to search for the string wally (ignoring case)
# }
# NOT RUN {
wheresWally <- function(v, ...) {
     res <- grepl("wally", v, ignore.case=TRUE)
     problem <- any(res)
     message <- "Wally was found in these data"
     checkResult(list(problem = problem,
                      message = message,
                      problemValues = v[res]))
}
wheresWally <- checkFunction(wheresWally,
                             description = "Search for the string 'wally' ignoring case",
                             classes = c("character")
                             )
# Add the newly defined function to the list of checks used for characters.
makeDataReport(testData, 
      checks = setChecks(character = defaultCharacterChecks(with = "wheresWally")),
      replace=TRUE)
# }
# NOT RUN {
#Handle non-supported variable classes using treatXasY: treat raw as character and
#treat complex as numeric. We also add a list variable, but as lists are not 
#handled through treatXasY, this variable will be caught in the preChecks and skipped:
# }
# NOT RUN {
toyData$rawVar <- as.raw(c(1:14, 1))
toyData$compVar <- c(1:14, 1) + 2i
toyData$listVar <- as.list(c(1:14, 1))
makeDataReport(toyData, replace  = TRUE, 
    treatXasY = list(raw = "character", complex = "numeric"))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab