Extract variables you want from the UKB database and create a CSV file to later upload to your own project.
Source:R/deprecated.R
create_csv_from_database.Rd
This function tells RAP to extract the variables you want from the .dataset
database file and to create a CSV file within the main RAP project folder.
When you want to use the CSV file in your own data analysis project, use
download_project_data()
. You probably don't need to run this function often,
probably only once at the start of your project. NOTE: This function takes
5 minutes to run on the UKB RAP, so be careful with just randomly running it.
Usage
create_csv_from_database(
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). Usesave_database_variables_to_project()
to create thedata-raw/rap-variables.csv
file, open that file, and delete all variables you don't want to keep. This is the file that contains thevariable_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 projectdare_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.