GeoTox: GeoTox S3 object

View source: R/GeoTox.R

GeoToxR Documentation

GeoTox S3 object

Description

Create a GeoTox object and connect to the underlying database.

Usage

GeoTox(dbname = tempfile(fileext = ".duckdb"), reset_seed = FALSE, ...)

get_con(GT)

Arguments

dbname

Database file name. Default is a temporary file.

reset_seed

Logical indicating whether to reset the user's global .Random.seed after certain database operations (default FALSE).

...

Additional arguments passed to DBI::dbConnect().

GT

GeoTox object.

Details

The dbname will point to a DuckDB database file. If the file does not already exist, a new database will be created. Additional arguments passed via ... will be forwarded to DBI::dbConnect().

The reset_seed parameter is necessary for replicating results from the previous GeoTox implementation. Some database functions create temporary tables where a random string is appended to the table name. This advances the .Random.seed state and causes functions that use randomness to produce different results between the previous and current implementations. Setting reset_seed = TRUE will reset the user's .Random.seed to the value it had before certain database operations.

Various parameters will be stored in the 'par' table. These parameters will also be loaded into the GeoTox object as a list in GT$par. The value for reset_seed can only be set on initial GeoTox object creation and will be loaded from the 'par' table for existing databases.

Value

For GeoTox(), a GeoTox S3 object. For get_con(), a database connection.

Examples

# Create a GeoTox object
GT <- GeoTox()

# Open a connection to GeoTox database
con <- get_con(GT)

# List database tables
DBI::dbListTables(con)

# Look at the GT parameters
dplyr::tbl(con, "par") |> dplyr::collect()
str(GT$par)

# Clean up example
DBI::dbDisconnect(con)
file.remove(GT$db_info$dbdir)

GeoTox documentation built on May 20, 2026, 1:07 a.m.