extractDataset: Extract a dataset for external ALSPAC users

View source: R/extractdataset.r

extractDatasetR Documentation

Extract a dataset for external ALSPAC users

Description

Extract a dataset for external ALSPAC users

Usage

extractDataset(
  variable_file,
  cid_file,
  b_number = "BXXXX",
  author = "Author",
  output_format = "sav",
  output_path = ".",
  output_file = file.path(output_path, paste0(author, "_", b_number, "_",
    format(Sys.time(), "%d%b%y"), ".", output_format)),
  dictionary = "both"
)

Arguments

variable_file

CSV file with column "Name" containing ALSPAC variable names.

cid_file

CSV file with two columns named "ALN" and the last letter of the filename (e.g. for "ACEHDBFG.txt" the column would be named "G").

b_number

B number of the project.

author

Last name of the project author.

output_format

"sav","csv" or "dta" (Default: "sav").

output_path

File path of output file, default is the current directory (Default: ".").

output_file

Dataset file (should not already exist). Default is derived from function arguments as follows: <output_path>/<author>_<b_number>_<date>.<output_format>.

dictionary

ALSPAC dictionary to use "current", "useful" or "both" (Default: "both").

Value

Saves the output dataset to 'output_file' and returns it.

Examples

## Not run: 
library(alspac)
setDataDir("R:/Data")
dat <- extractDataset(
         variable_file="ACEHDBFG.txt",
         cid_file="Vars_from_Explore.csv",
         output_format="sav",
         b_number="B0001",
         author="Smith")
## creates a data file with a name like "Smith_B0001_12Jul21.sav"
## in the current directory

## End(Not run)

explodecomputer/alspac documentation built on Feb. 16, 2024, 4:18 p.m.