swissmetro_data: Prepare the Swissmetro database used by Biogeme's examples

View source: R/swissmetro.R

swissmetro_dataR Documentation

Prepare the Swissmetro database used by Biogeme's examples

Description

The transformation is deliberately expressed as native database operations. It removes rows with PURPOSE other than 1 or 3 and rows with CHOICE == 0, then defines the cost, availability, and ⁠/100⁠ scaled variables used by plot_b01a_logit.py. Row order and original row IDs are retained. Set panel = TRUE to declare ID as the panel identifier.

Usage

swissmetro_data(
  data,
  name = "swissmetro",
  panel = FALSE,
  filter_purpose = TRUE
)

prepare_swissmetro(
  data,
  name = "swissmetro",
  panel = FALSE,
  filter_purpose = TRUE
)

Arguments

data

Numeric Swissmetro data frame.

name

Database name.

panel

Whether to declare the ID panel identifier.

filter_purpose

Whether to retain only observations with PURPOSE equal to 1 or 3, in addition to removing CHOICE == 0. Set this to FALSE for native examples whose read_data() keeps all purposes.

Value

A biogeme_database specification.


rbiogeme documentation built on Sept. 29, 2026, 5:09 p.m.