shs_create_names_workbooks: Extract column and variable names from raw data

Description Usage Arguments Value Examples

View source: R/shs_create_names_workbooks.R

Description

shs_create_names_workbooks extracts column and variable names from an SHS survey dataset, and writes the output to Excel. The output file 'column_names.xlsx' will contain all column names in the source files, minus any specified in the column_names_to_exclude argument. The output file 'variable_names.xlsx' will contain all unique values present in the second column of all tables in the raw data, once columns names in column_names_to_exclude are removed. The resulting Excel sheets will both have two columns: source_name and display_name. The display name value is the value that will be displayed in the final Shiny app, these values can be added manually or by providing paths of existing, populated sheets to the arguments existing_column_names_path and existing_variable_names_path.

Usage

1
2
3
4
5
6
7
shs_create_names_workbooks(
  destination_directory,
  source_dataset_directory,
  columns_to_remove,
  existing_column_names_path = NULL,
  existing_variable_names_path = NULL
)

Arguments

destination_directory

string. The path of the directory to write the column names and variables names Excel files to.

source_dataset_directory

string. The path of the directory containing source data and metadata in Excel format.

columns_to_remove

string. Unnecessary columns to remove from the dataset.

existing_column_names_path

string. A path to an existing Excel file with the same structure. Any display_name values will be copied to the new output file.

existing_variable_names_path

string. A path to an existing Excel file with the same structure. Any display_name values will be copied to the new output file.

Value

null.

Examples

1
2
3
4
## Not run: 
shs_create_names_workbooks(destination_directory, source_dataset_directory, columns_to_remove, existing_column_names_path, existing_variable_names_path)

## End(Not run)

DataScienceScotland/shsannualreport documentation built on Dec. 17, 2021, 4:07 p.m.