Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

keySave

Save key as file after deducing type from suffix


Description

This is specialized to saving of key objects, it is not a general purpose function for saving things. It scans the suffix of the file name and then does the right thing.

Usage

keySave(obj, file, na_ = ".", varlab)

Arguments

obj

a variable key object

file

file name. must end in "csv", "xlsx" or "rds"

na_

Value to insert to represent a missing score. Default ".".

varlab

FALSE or TRUE. Default is FALSE, no new labels will be created. If a key object has a varlab already, it is saved with the key, always. This parameter controls whether a new varlab template should be created when the object is saved. If TRUE and obj has no varlab attribute, a new varlab template is created by the varlabTemplate function. If TRUE and a varlab attribute currently exists, but some variables are missing labels, then varlabTemplate is called to fill in new variable labels.

Details

In updates 2017-09, a varlab element was introduced. The varlab attribute of the object is saved. The files created incorporate the variable labels object in different ways. 1) XLSX: variable labels a worksheet named "varlab" 2) CSV: variable labels saved in a separate file suffixed "-varlab.csv". 3) RDS: varlab is an attribute of the key object.

Value

NULL if no file is created. Otherwise, a key object with an attribute varlab is returned.

Author(s)

Paul Johnson <pauljohn@ku.edu>


kutils

Project Management Tools

v1.70
GPL-2
Authors
Paul Johnson [aut, cre], Benjamin Kite [aut], Charles Redmon [aut], Jared Harpole [ctb], Kenna Whitley [ctb], Po-Yi Chen [ctb], Shadi Pirhosseinloo [ctb]
Initial release
2020-04-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.