duckdb_type_mappings: DuckDB to R Type Mappings

View source: R/type_helpers.R

duckdb_type_mappingsR Documentation

DuckDB to R Type Mappings

Description

The mapping covers the most common data types used in HTS file processing:

  • BIGINT <-> double (not integer due to 64-bit overflow protection)

  • DOUBLE <-> numeric/double

  • VARCHAR <-> character/string

  • BOOLEAN <-> logical

  • ARRAY types (e.g., VARCHAR[], BIGINT[]) <-> list

  • MAP types (e.g., MAP(VARCHAR, VARCHAR)) <-> data.frame

Important notes:

  • 64-bit integers (BIGINT, UBIGINT) become double to prevent overflow

  • DATE/TIME values return as Unix epoch numbers (double)

  • MAP types become data frames with 'key' and 'value' columns

  • ARRAY types become vectors (which are lists in R terminology)

Usage

duckdb_type_mappings()

Details

Returns a named list mapping between DuckDB and R data types. This is useful for understanding type conversions when reading HTS files or when specifying column types in tabix functions.

Value

A named list with two elements:

duckdb_to_r

Named character vector mapping DuckDB types to R types

r_to_duckdb

Named character vector mapping R types to DuckDB types

Examples

mappings <- duckdb_type_mappings()
mappings$duckdb_to_r["BIGINT"]
mappings$r_to_duckdb["integer"]


Rduckhts documentation built on Oct. 25, 2026, 1:08 a.m.