knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
# output: github_document # always_allow_html: true
This package of createdictionary was developed at the Neuroepidemiology Section (NES) of Laboratory of Epidemiology & Population Science (LEPS), NIA. The goal is to build a one-document dictionary from multiple datasets; the key values are extracted for each variable.
You can install the released version of createdictionary from CRAN with (This installation option is currently unavailable yet):
install.packages("createdictionary")
And the development version from GitHub with:
# install.packages("devtools") devtools::install_github("LEPSNES/createdictionary")
This is a basic example which shows you how to solve a common problem:
library(createdictionary) library(haven)
## get folder path df <- system.file(package = "haven") ## search all the files under the folder for sas dataset dse <- flat2file(df, "*.sas7bdat") ## dic_value_extract_one_dataset_path uses file path as input dse %>% dic_value_extract_one_dataset_path() ## dic_value_extract_one_dataset uses a data frame as input dse[1] %>% read_sas() %>% dic_value_extract_one_dataset() ## dic_value_extract_one_var process a variable each time dse %>% read_sas() %>% imap_dfr( ~ dic_value_extract_one_var(.x, .y))
df <- "/LSC/NES/study/CARDIA/core datasets/Y25/DATA" ## on windows, use this ## df <- "T:/LEPS/NES/study/CARDIA/core datasets/Y25/DATA" dse <- flat2file(df, "*.sas7bdat") dse[3] %>% dic_value_extract_one_dataset_path() dse[1:3] %>% map_dfr(dic_value_extract_one_dataset_path) %>% slice_head(n=7)
Please check the help document for each function to see how to use them.
?flat2file ?dic_value_extract_one_dataset_path ?dic_value_extract_one_dataset ?dic_value_extract_one_var
This package generates two comma-separated value (CSV) file, one of which provides variable-level information, the other provides dataset, i.e. file, level information.
Here are the column name and their descriptions in
database table
handle possible file opening errors
handle possible value extraction errors
Hope this tool can be of somewhat help with your research.
any comments or suggestions are welcome!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.