Description Usage Arguments Details Value Author(s) Examples
read_codebook
reads a code book stored as a csv
file
for either checking against a data file or relabelling factor
levels or labelling variables.
1 2 3 | read_codebook(x, codebook_directory = NULL, column_names = NULL,
na = c("", "NA", ".", " "),
data_management_plan = "All possible details should be here")
|
x |
filename of codebook to parse |
codebook_directory |
directory containing codebook. Default : current directory |
column_names |
named character vector containing column names
in Code Book file. The vector contains components
|
na |
a character vector of strings which are to be
interpreted as ‘NA’ values. Blank fields are also
considered to be missing values in logical, integer, numeric and
complex fields. Default: |
data_management_plan |
a list containing information like url, location, authors, date, version and so on. Default: "All possible details should be here" |
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.
S3 object of type class codebook
Peter Baker pete@petebaker.id.au
1 2 3 4 5 6 | file.copy(system.file('demoFiles', 'data1_codebook.csv',
package='codebookr'), 'data1_codebook.csv')
data1_codebook <- read_codebook("data1_codebook.csv",
column_names = list(variable_levels = "Factor.Levels",
variable_original = "Old.Variable",
min = "Min", max = "Max"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.