Skip to contents

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, ...)

# Default S3 method
ns_write_codebook(codebook, path, ...)

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

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

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.

Value

no return value. Writes a file to path.

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

if (FALSE) { # \dontrun{
form_id <- 1100000
my_cb <- ns_get_codebook(form_id)
ns_write_codebook(my_cb, "my/path/codebook_110000.txt")
} # }