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.

nettskjema_write_codebook(codebook, file, ...)

# S3 method for default
nettskjema_write_codebook(codebook, file, ...)

# S3 method for nettskjema_codebook_raw
nettskjema_write_codebook(codebook, file, pretty = TRUE, ...)

# S3 method for nettskjema_codebook
nettskjema_write_codebook(codebook, file, sep = "\t", ...)

Arguments

codebook

object of class nettskjema_codebook

file

filename or path

...

arguments to write_json or write.table

pretty

logical. If writing json-file, make it pretty

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) { form_id <- 1100000 my_cb <- nettskjema_get_codebook(form_id) nettskjema_write_codebook(my_cb, "my/path/codebook_110000.txt") }