Skip to contents

An R6 class that provides an interface to a folder-based data storage system for the evoland package. Each table is stored as a parquet (or CSV) file. This class uses DuckDB for in-memory SQL operations while persisting data to disk in parquet format for better compression.

Inherits from parquet_duckdb for generic database operations.

See also

Additional methods and active bindings are added to this class in separate files:

Super class

evoland::parquet_duckdb -> evoland_db

Methods

Inherited methods


Method set_neighbors()

Usage

evoland_db$set_neighbors(
  max_distance = 1000,
  distance_breaks = c(0, 100, 500, 1000),
  resolution = 100,
  overwrite = FALSE
)


Method generate_neighbor_predictors()

Usage

evoland_db$generate_neighbor_predictors()


Method trans_pred_data_v()

Usage

evoland_db$trans_pred_data_v(id_trans, id_pred = NULL, na_value = NA)


Method new()

Initialize a new evoland_db object

Usage

evoland_db$new(path, default_format = c("parquet", "csv"), ...)

Arguments

path

Character string. Path to the data folder.

default_format

Character. Default file format ("parquet" or "csv"). Default is "parquet".

...

passed on to set_report

Returns

A new evoland_db object


Method fetch()

Fetch data from storage with evoland-specific view support

Usage

evoland_db$fetch(table_name, where = NULL, limit = NULL)

Arguments

table_name

Character string. Name of the table to query.

where

Character string. Optional WHERE clause for the SQL query.

limit

integerish, limit the amount of rows to return

Returns

A data.table


Method set_report()

Set reporting metadata

Usage

evoland_db$set_report(...)

Arguments

...

each named argument is entered into the table with the argument name as its key


Method set_coords()

Set coordinates for DB. Cannot overwrite existing table (would mean cascading deletion)

Usage

evoland_db$set_coords(type = c("square"), ...)

Arguments

type

string; which type of coordinates to set, see coords_t

...

named arguments are passed to the appropriate coordinate creator function


Method set_periods()

Set periods for DB. See periods_t

Usage

evoland_db$set_periods(
  period_length_str = "P10Y",
  start_observed = "1985-01-01",
  end_observed = "2020-01-01",
  end_extrapolated = "2060-01-01"
)

Arguments

period_length_str

ISO 8601 duration string specifying the length of each period (currently only accepting years, e.g., "P5Y" for 5 years)

start_observed

Start date of the observed data (YYYY-MM-DD)

end_observed

End date of the observed data (YYYY-MM-DD)

end_extrapolated

End date for extrapolation time range (YYYY-MM-DD)


Method add_predictor()

Add a predictor to the database

Usage

evoland_db$add_predictor(pred_spec, pred_data, pred_type)

Arguments

pred_spec

List of predictor specification; see create_pred_meta_t()

pred_data

An object that can be coerced to pred_data_t, but doesn't have an id_pred

pred_type

Passed to as_pred_data_t(); one of float, int, bool


Method fit_partial_models()

Usage

evoland_db$fit_partial_models(
  fit_fun,
  gof_fun,
  sample_pct = 70,
  seed = NULL,
  na_value = NA,
  ...
)


Method fit_full_models()

Usage

evoland_db$fit_full_models(
  partial_models,
  gof_criterion,
  maximize = TRUE,
  na_value = NA,
  envir = parent.frame()
)


Method set_full_trans_preds()

Usage

evoland_db$set_full_trans_preds(overwrite = FALSE)


Method get_pruned_trans_preds_t()

Usage

evoland_db$get_pruned_trans_preds_t(
  filter_fun = covariance_filter,
  na_value = NA,
  ...
)


Method clone()

The objects of this class are cloneable with this method.

Usage

evoland_db$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.