ns_write_codebook: Write codebook to file

View source: R/ns-codebook.R

ns_write_codebookR Documentation

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

## 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.

Details

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

codebook

- writes a tab-separated table

codebook_raw

- writes a json-file

Value

no return value. Writes a file to path.

Examples

## Not run: 
form_id <- 1100000
my_cb <- ns_get_codebook(form_id)
ns_write_codebook(my_cb, "my/path/codebook_110000.txt")

## End(Not run)

LCBC-UiO/nettskjemar documentation built on April 11, 2025, 11:01 p.m.