Skip to content

R

To install the latest release from CRAN:

install.packages("bedrockbio")

Load package:

library(bedrockbio)

List available namespaces and tables:

list_namespaces()
list_tables()

Lazily load a table (returns a tbl_lazy object):

pqtls_tbl_lazy <- load_table("ukb_ppp.pqtls")

Filter columns and rows of the lazy table using dplyr verbs:

library(dplyr)

pqtls_tbl_lazy <- pqtls_tbl_lazy |>
    filter(
        ancestry == "EUR",
        protein_id == "A0FGR8",
        neg_log_10_p_value >= 7.30  # p-value ~5e-8
    ) |>
    select(
        chromosome,
        position_grch38,
        effect_allele,
        other_allele,
        beta,
        neg_log_10_p_value
    )

Collect to a tibble object (triggers data download):

pqtls_tbl <- pqtls_tbl_lazy |> collect()

Or, collect to a plain data frame (also triggers download):

pqtls_df <- pqtls_tbl_lazy |> as.data.frame()
Signature Description Returns
list_namespaces() List namespace identifiers. character
list_tables(namespace = NULL) List all tables, filtered to a namespace if specified. character
describe_namespace(name) Inspect namespace metadata. list
describe_table(name) Inspect table metadata. list
load_table(name) Lazily load the specified table identifier. tbl_lazy