get_var_label: Retrieve variable labels from OKX data frames

View source: R/utils_labels.R

get_var_labelR Documentation

Retrieve variable labels from OKX data frames

Description

Returns human-readable labels attached to a data frame produced by OKX API parsers. You can retrieve all labels or a label for a specific variable by name or index.

Usage

get_var_label(df, var = NULL, default = NA_character_)

Arguments

df

A data.frame with "var_labels" attribute (as returned by OKX API parsers).

var

Optional variable name (character) or index (numeric). If NULL, all labels are returned.

default

Value to return if the variable has no label (default: NA_character_).

Value

A character label if var is provided, or a named character vector of all labels if var = NULL.

Examples

df <- data.frame(ordId = "123", px = 10)
attr(df, "var_labels") <- c(ordId = "Order ID", px = "Price")

get_var_label(df, "ordId")
get_var_label(df, 2)
get_var_label(df)


okxr documentation built on May 8, 2026, 5:09 p.m.