import_vega_data {altair}R Documentation

Import Vega datasets

Description

Lets you access Vega datasets.

Usage

import_vega_data()

Details

Returns the data object in the Python package vega-datasets. In the documentation for this package, the convention is to assign this object to the name vega_data.

Value

An S3 object of class vega_datasets.core.DataLoader

See Also

Vega datasets documentation

Examples

if (interactive()) {
  vega_data <- import_vega_data()

  # To list available datasets
  print(vega_data$list_datasets())

  # When accessing a dataset, substitute any "-" in the name with a "_"
  print(head(vega_data$sf_temps()))

  # Metadata are available for each dataset:
  print(vega_data$anscombe$references)
  print(vega_data$anscombe$description)
  print(vega_data$anscombe$url)

  # For local datasets, local path is available
  print(vega_data$sf_temps$filepath)
}

[Package altair version 4.1.1 Index]