Learn R Programming

Rparadox (version 0.2.2)

read_paradox: Read a Paradox Database File into a Tibble

Description

A high-level, user-friendly wrapper function that reads an entire Paradox database file (.db) and returns its contents as a tibble.

Usage

read_paradox(path, encoding = NULL, password = NULL)

Value

A tibble containing the data from the Paradox file.

Arguments

path

A character string specifying the path to the Paradox (.db) file.

encoding

An optional character string specifying the input encoding of the data (e.g., "cp866", "cp1252"). If NULL (the default), the encoding is determined from the file header.

password

Optional character string. The password used to decrypt the Paradox file. If the file is encrypted and no password is provided, reading usually fails or returns garbage.

Details

This function simplifies the process of reading Paradox files by handling the complete workflow in a single call:

  1. It validates the input path and encoding.

  2. It safely opens a handle to the file using pxlib_open_file().

  3. It ensures the file handle is always closed using on.exit(), even if errors occur during data reading.

  4. It reads the data using pxlib_get_data().

  5. It returns a clean tibble.

If the specified file does not exist, the function will issue a warning and return an empty tibble.

Examples

Run this code
# Read the demo database in one step
db_path <- system.file("extdata", "biolife.db", package = "Rparadox")
if (file.exists(db_path)) {
  biolife_data <- read_paradox(db_path)
  print(biolife_data)
}

Run the code above in your browser using DataLab