View source: R/extractdataset.r
extractDataset | R Documentation |
Extract a dataset for external ALSPAC users
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 = "current"
)
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" (Default: "current"). |
Saves the output dataset to 'output_file' and returns it.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.