get_ukb_dummy: Dummy UK Biobank data

View source: R/dummy_data.R

get_ukb_dummyR Documentation

Dummy UK Biobank data

Description

Either read a dummy UK Biobank dataset into R or return the file path only.

Usage

get_ukb_dummy(file_name, path_only = FALSE)

Arguments

file_name

Name of dummy dataset file.

path_only

If TRUE, return the file path to the dummy dataset file, otherwise if FALSE (default), read the dummy dataset into R.

Details

The following dummy datasets are included with this package:

  • dummy_Data_Dictionary_Showcase.tsv: A subset of fields from the UK Biobank data dictionary (full version available from the UK Biobank data showcase website).

  • dummy_Codings.tsv: A subset of UK Biobank data codings (full version available from the UK Biobank data showcase website).

  • dummy_ukb_main.tsv: A dummy main UK Biobank dataset. May be read into R with read_ukb(). Tidy clinical events fields with tidy_clinical_events().

  • dummy_gp_clinical.txt: A dummy UK Biobank primary care clinical event records dataset.

  • dummy_gp_scripts.txt: A dummy UK Biobank primary care prescription records dataset.

Value

A data frame if path_only is FALSE (default) or a string if path_only is TRUE.

Examples

library(magrittr)

# available dummy datasets
dummy_datasets <- c(
  "dummy_Data_Dictionary_Showcase.tsv",
  "dummy_Codings.tsv",
  "dummy_ukb_main.tsv",
  "dummy_gp_clinical.txt",
  "dummy_gp_scripts.txt"
)

# read dummy dataset into R
get_ukb_dummy("dummy_ukb_main.tsv")

# get file path to dummy dataset
get_ukb_dummy("dummy_ukb_main.tsv", path_only = TRUE)

# read all available dummy dataset into R
dummy_datasets %>%
  purrr::set_names() %>%
  purrr::map(get_ukb_dummy, path_only = FALSE) %>%
  purrr::map(tibble::as_tibble)

rmgpanw/ukbwranglr documentation built on April 30, 2024, 7:47 a.m.