Description Usage Arguments Details Value Author(s) Examples
Uses a codebook which is an S3 class codebook
, possibly
read in by read_codebook
, to check for data within valid
ranges.
1 | validate_limits(x, code_book, column_names = NULL)
|
x |
|
code_book |
|
column_names |
character vector of column names for checking
data in range. Default: All continuous variables defined in
|
REPEAT: Often, when analysing data, data dictionaries or code books are
provided with data files. Rather than a word
doc
or
pdf
files, the format required here is in a very specific
format stored as a csv
file. Once read in, attributes such
as factor labels/levels and variable labels can be added to the
data.frame
and/or also used to check factor labels and
variable names are consistent with the code book. Note that while
various methods may be available which attempt to convert word
docs or pdf's to a spreadsheet and/or csv file, extreme care
should be taken as these are far from perfect.
object of type class tibble
containing data out of
limits
Peter Baker pete@petebaker.id.au
1 2 3 4 5 6 7 8 9 10 11 | file.copy(system.file('demoFiles', 'data1_codebook.csv',
package='codebookr'), 'data1_codebook.csv')
file.copy(system.file('demoFiles', 'data1-yr21.csv',
package='codebookr'), 'data1-yr21.csv')
data1_codebook <- read_codebook("data1_codebook.csv",
column_names = list(variable_levels = "Factor.Levels",
variable_original = "Old.Variable",
min = "Min", max = "Max"))
data1 <- readr::read_csv('data1-yr21.csv')
data1
non_valid <- validate_limits(data1, data1_codebook)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.