Learn R Programming

nettskjemar (version 1.0.1)

ns_write_codebook: Write codebook to file

Description

Save codebook information to a file for safe keeping. Depending on the type of codebook (raw or tidy) the file will either be stored as a json-file through write_json or a text table through write.table.

Usage

ns_write_codebook(codebook, path, ...)

# S3 method for default ns_write_codebook(codebook, path, ...)

# S3 method for ns_codebook_raw ns_write_codebook(codebook, path, ...)

# S3 method for ns_codebook ns_write_codebook(codebook, path, sep = "\t", ...)

Value

no return value. Writes a file to path.

Arguments

codebook

object of class ns_codebook

path

filename or path

...

arguments to write_json or write.table

sep

character. If writing text table, column delimiter.

Details

Given the two types of codebooks, writes different types of files.

codebook

- writes a tab-separated table

codebook_raw

- writes a json-file

Examples

Run this code
if (FALSE) {
form_id <- 1100000
my_cb <- ns_get_codebook(form_id)
ns_write_codebook(my_cb, "my/path/codebook_110000.txt")
}

Run the code above in your browser using DataLab