Skip to contents

[Stable] Set dataset primary keys

Usage

set_keys(x, ...)

# S3 method for TealDataset
set_keys(x, keys, ...)

# S3 method for TealDatasetConnector
set_keys(x, keys, ...)

# S3 method for TealDataAbstract
set_keys(x, dataname, keys, ...)

Arguments

x

an object of TealDataset or TealDatasetConnector class

...

not used, only for support of S3

keys

optional, (character) vector with primary keys

dataname

(character) name of dataset for which set the keys

Value

(character) vector of column names

Examples

# TealDataset --------

set_keys(
  dataset(
    "DF",
    data.frame(ID = 1:10, x = runif(10))
  ),
  keys = c("ID")
)
# TealDatasetConnector --------

pull_fun <- callable_function(
  function() {
    data.frame(ID = 1:10, x = runif(10))
  }
)
set_keys(
  dataset_connector(
    "DF",
    pull_fun
  ),
  keys = c("ID")
)
# TealData --------

set_keys(
  teal_data(
    dataset("x", data.frame(x1 = 1:10, y1 = 11:20), keys = "x1"),
    dataset("y", data.frame(x2 = 1:10, y2 = 11:20), keys = "x2")
  ),
  "x",
  c("x1", "y1")
)