Skip to contents

This function joins multiple RIO tables based on the relations defined in the package. It automatically detects relations between tables and chooses the optimal join path. When GPS coordinates are available, the result can be converted to an sf object.

Usage

rio_join(
  ...,
  by_names = TRUE,
  reference_date = Sys.Date(),
  nested = FALSE,
  find_paths = TRUE,
  max_path_length = 10,
  as_sf = FALSE,
  remove_invalid = FALSE,
  filters = NULL,
  query = NULL,
  quiet = FALSE
)

Arguments

...

Character vector of table names to load or named tibbles to join.

by_names

Logical indicating whether the arguments are table names rather than actual datasets. Default is TRUE.

reference_date

Optional date to filter valid records. Default is the current date (Sys.Date()). Set to NULL to disable date filtering.

nested

Logical indicating whether to return a nested tibble. Default is FALSE.

find_paths

Logical indicating whether to find indirect connection paths between datasets that are not directly connected. Default is TRUE.

max_path_length

Maximum length of connection paths to consider when find_paths is TRUE. Default is 10.

as_sf

Logical indicating whether to convert the result to an sf object when GPS coordinates are available. Default is FALSE.

remove_invalid

Logical indicating whether to remove rows with invalid or missing coordinates when converting to sf. Default is FALSE.

filters

Optional named list of filters to apply when loading data. Filters will be applied to all tables where the filter column exists.

query

Optional search query string for full-text search. Default is NULL.

quiet

Logical indicating whether to suppress progress messages. Default is FALSE.

Value

A joined tibble, or an sf object if as_sf = TRUE and GPS coordinates are available.

Examples

if (FALSE) { # \dontrun{
# Join tables by name (default method)
joined_data <- rio_join("vestigingserkenningen", "onderwijslocaties")

# Return as sf object for mapping
geo_data <- rio_join("vestigingserkenningen", "onderwijslocaties", as_sf = TRUE)

# Join with a specific reference date
joined_data <- rio_join("vestigingserkenningen", "onderwijslocaties",
                        reference_date = as.Date("2023-01-01"))

# Join with filters on the data
joined_data <- rio_join("vestigingserkenningen", "onderwijslocaties",
                        filters = list(PLAATSNAAM = "Utrecht"))

# Return a nested tibble
nested_data <- rio_join("vestigingserkenningen", "onderwijslocaties", nested = TRUE)
} # }