Permalink
Browse files

Added initial prototype for makeCodebook

  • Loading branch information...
ekstroem committed Jan 16, 2018
1 parent e576c6c commit b53bb6147bfb3764709016ba3b1e4e98130ef8a9
View
@@ -131,6 +131,7 @@ export(isEmpty)
export(isKey)
export(isSingular)
export(isSupported)
export(makeCodebook)
export(makeDataReport)
export(messageGenerator)
export(minMax)
View
@@ -1161,6 +1161,3 @@ doCheckLabs <- function(v) {
return(v)
}
View
@@ -491,7 +491,7 @@ makeDataReport <- function(data, output=NULL, render=TRUE,
doSummarize <- "summarize" %in% mode
if (!doCheck & !doVisualize & !doSummarize & !silent) {
warning("Note that no proper arguments were supplied to \"mode\" - no data report genereation performed")
warning("Note that no proper arguments were supplied to \"mode\" - no data report generation performed")
} #rewrite warning message
## Disregard the twocolumn option if we're only asking for one of visualize and summarize
@@ -1143,3 +1143,30 @@ doCheckLabs <- function(v) {
#' Produce a data codebook
#'
#' Make a data codebook that summarizes the contents of a dataset.
#' The result is saved to an R markdown file which can
#' rendered into an easy-to-read codebook in pdf, html or word formats.
#'
#' @param data The dataset to be checked. This dataset should be of class \code{data.frame},
#' \code{tibble} or \code{matrix}. If it is of classs \code{matrix}, it will be converted to a
#' \code{data.frame}.
#'
#' @param vol Extra text string or numeric that is appended on the end of the output
#' file name(s). For example, if the dataset is called "myData", no file argument is
#' supplied and \code{vol=2}, the output file will be called "dataMaid_myData2.Rmd"
#'
#' @param reportTitle A text string. If supplied, this will be the printed title of the
#' report. If left unspecified, the title with the name of the supplied dataset.
#'
#' @export
makeCodebook <- function(data, vol="", reportTitle=NULL, ...) {
dfname <- deparse(substitute(data))
makeDataReport(data,
reportTitle=paste0("Codebook for ", dfname),
file=normalizeFileName(paste0("codebook_", dfname, vol, ".Rmd")),
...)
}
@@ -2,7 +2,7 @@
dataMaid: yes
title: artData
subtitle: "Autogenerated data summary from dataMaid"
date: 2017-12-21 01:29:36
date: 2018-01-12 19:32:44
output: html_document
---
```{r , echo=FALSE, include=FALSE, warning=FALSE, message=FALSE, error=FALSE}
@@ -656,13 +656,13 @@ Report generation information:
* Created by Claus Thorn Ekstrøm.
* Report creation time: Thu Dec 21 2017 01:29:36
* Report creation time: Fri Jan 12 2018 19:32:44
* dataMaid v1.0.1 [Pkg: 2017-11-13 from local (ekstroem/dataMaid@NA)]
* R version 3.4.3 (2017-11-30).
* Platform: x86_64-apple-darwin15.6.0 (64-bit)(macOS High Sierra 10.13.1).
* Platform: x86_64-apple-darwin15.6.0 (64-bit)(macOS High Sierra 10.13.2).
* Function call: `makeDataReport(data = artData, output = "html", preChecks = c("isKey",
"isSingular", "isSupported", "isID"), replace = TRUE, openResult = FALSE,

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit b53bb61

Please sign in to comment.