dic_value_extract_one_dataset_path: extract information from one single dataset provided as file...

Description Usage Arguments Value Examples

View source: R/dic_value_extract.R

Description

This function can now handle the read_sas error by employing the purrr::safely strategy, which would lead to one row output of all NA's except filename and dirname. Moreover, the total row number of each dataset is also provided as total_row.

Usage

1

Arguments

dataset_path

the full path to the dataset from which key values will be extracted

Value

a dataframe including the values extracted from each variable in the dataset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# mtcars.sas7bdat was generated from R mtcars dataset
df <- system.file("extdata", "mtcars.sas7bdat", package = "createdictionary")
df %>%
  dic_value_extract_one_dataset_path()
# should work if there exist sas7bdat datasets in R path.
# The package "haven" have such datasets.
df <- system.file(package = "haven")
dse <- flat2file(df, "*.sas7bdat")
dse[1] %>%
  dic_value_extract_one_dataset_path()

# need access to the specified folder and have sas7bdat datasets there
df <- "/LSC/NES/study/CARDIA/core datasets/Y25/DATA"
dse <- flat2file(df, "*.sas7bdat")
dse[3] %>%
  dic_value_extract_one_dataset_path()

value_extracted <-  dse %>%
  map_dfr(dic_value_extract_one_dataset_path)

LEPSNES/createdictionary documentation built on Dec. 13, 2021, 1:51 a.m.