Description Usage Arguments Value Examples
save_it
saves datset with attributes stored as metadata as an R
dataset (.rds) into the current working directory. This is the final function
used in this package. For the function to run, the following parameters are needed.
1 | save_it(x, name_of_file)
|
x |
Data.frame. Dataset that has attributes added, including a data dictionary. |
name_of_file |
Text string to name the file. |
This function will save the dataset along with its attributes as an R dataset (.rds) to the current working directory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # example original data set for which a dictionary will be made
data("esoph")
my.data <- esoph
# Linker: Add description for each variable names and variable type
variable_description <- c("age group in years", "alcohol consumption in gm/day",
"tobacco consumption in gm/day", "number of cases (showing a range)",
"number of controls (showing range)")
variable_type <- c(0, 0, 0, 0, 0)
linker <- build_linker(my.data = my.data, variable_description = variable_description,
variable_type = variable_type)
linker
# Data dictionary
# For this data set, no further option description is needed.
dictionary <- build_dict(my.data = my.data, linker = linker, option_description = NULL,
prompt_varopts = FALSE)
dictionary
# Create main_string for attributes
main_string <- "This dataset describes tobacco and alcohol consumption at different age groups."
complete_dataset <- incorporate_attr(my.data = my.data, data.dictionary = dictionary,
main_string = main_string)
complete_dataset
attributes(complete_dataset)
# Save it
# Name of file
name_of_file <- "my new data set"
save_it(x = complete_dataset, name_of_file = name_of_file)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.