Skip to contents

This is mostly for testing purposes.

Usage

builder_table_exporter(
  variables_to_extract,
  field = c("name", "title"),
  file_prefix = "data",
  project_id = get_rap_project_id(),
  dataset_record_id = dare_project_record_id,
  username = rap_get_user()
)

Arguments

variables_to_extract

A character vector of variables you want to extract from the UKB database (from the .dataset file). Use save_database_variables_to_project() to create the data-raw/rap-variables.csv file, open that file, and delete all variables you don't want to keep. This is the file that contains the variable_name column you would use for this argument.

file_prefix

The prefix to add to the start of the file name. Defaults to "data".

project_id

The project's abbreviation. Defaults to using get_rap_project_id(), which is the name of the project folder.

dataset_record_id

The "record ID" of the database, found when clicking the .dataset file in the RAP project folder. Defaults to the ID for the Steno project dare_project_record_id.

username

The username to set where the dataset is saved to. Defaults to using rap_get_user(), which is the name of the current user of the session.

Value

Outputs character string of command sent to dx.

Examples

library(tibble)
library(dplyr)
library(stringr)
library(magrittr)
#> 
#> Attaching package: ‘magrittr’
#> The following object is masked from ‘package:purrr’:
#> 
#>     set_names
#> The following object is masked from ‘package:tidyr’:
#> 
#>     extract
rap_variables %>%
  sample_n(10) %>%
  pull(id) %>%
  builder_table_exporter(project_id = "test", username = "lwj") %>%
  cat()
#> Error in builder_table_exporter(., project_id = "test", username = "lwj"): could not find function "builder_table_exporter"