Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rparadox: A Modern Interface for Reading Paradox Databases in R

License

NotificationsYou must be signed in to change notification settings

celebithil/Rparadox

Repository files navigation

CRAN statusCRAN downloadsAsk DeepWiki

Rparadox: A Modern Interface for Reading Paradox Databases in R

Rparadox provides a simple and efficient way to read data fromParadox database files (.db) directly into R as moderntibble dataframes. It uses the underlyingpxlib C library to handle the low-levelfile format details and provides a clean, user-friendly R interface.

This package is designed to “just work” for the most common use case:extracting the full dataset from a Paradox table, including itsassociated BLOB/memo file (.mb).


Features

  • Direct Reading: Reads Paradox.db files without needing databasedrivers or external software.
  • Tibble Output: Returns data in thetibble format, which is fullycompatible with the Tidyverse ecosystem.
  • Automatic BLOB Handling: Automatically detects, attaches, andreads data from associated memo/BLOB (.mb) files.
  • Character Encoding Control: Automatically handles characterencoding conversion to UTF-8 and allows the user to manually overridethe source encoding for files with incorrect headers.
  • Type Conversion: Correctly maps Paradox data types to theircorresponding R types, includingDate,Time (hms),Timestamp(POSIXct),Logical,Integer,Numeric, and binaryblobobjects.

Installation

# stable version from CRANinstall.packages("Rparadox")

You can install the development version of Rparadox from GitHub usingthedevtools package.

# install.packages("devtools")devtools::install_github("celebithil/Rparadox")

Usage

Basic Usage: Theread_paradox() function

The easiest way to read a Paradox file is with the high-levelread_paradox() function. It handles opening the file, reading thedata, and closing the connection in a single step.

# 1. Load the packagelibrary(Rparadox)# 2. Get the path to an example databasedb_path<- system.file("extdata","biolife.db",package="Rparadox")# 3. Read the data directly into a tibble# This automatically finds 'biolife.mb' and handles data types.biolife_data<- read_paradox(db_path)# 4. View the dataprint(biolife_data)#> # A tibble: 28 × 8#>    `Species No` Category      Common_Name `Species Name` `Length (cm)` Length_In#>           <dbl> <chr>         <chr>       <chr>                  <dbl>     <dbl>#>  1        90020 Triggerfish   Clown Trig… Ballistoides …            50     19.7#>  2        90030 Snapper       Red Emperor Lutjanus sebae            60     23.6#>  3        90050 Wrasse        Giant Maor… Cheilinus und…           229     90.2#>  4        90070 Angelfish     Blue Angel… Pomacanthus n…            30     11.8#>  5        90080 Cod           Lunartail … Variola louti             80     31.5#>  6        90090 Scorpionfish  Firefish    Pterois volit…            38     15.0#>  7        90100 Butterflyfish Ornate But… Chaetodon Orn…            19      7.48#>  8        90110 Shark         Swell Shark Cephaloscylli…           102     40.2#>  9        90120 Ray           Bat Ray     Myliobatis ca…            56     22.0#> 10        90130 Eel           California… Gymnothorax m…           150     59.1#> # ℹ 18 more rows#> # ℹ 2 more variables: Notes <chr>, Graphic <blob>

biolife.db

biolife.db

Handling Incorrect Character Encoding

If you have a legacy file where the encoding is specified incorrectly inthe header, you can manually override it using theencoding parameterwithread_paradox().

library(Rparadox)# This tells the package to interpret the source data as CP866data<- read_paradox("path/to/your/file.db",encoding="cp866")

This ensures that all text fields are correctly converted to UTF-8 inthe finaltibble.

Advanced Usage

For more control, you can use the lower-level functions. This is usefulif you want to inspect metadata before reading the full dataset.

library(Rparadox)db_path<- system.file("extdata","biolife.db",package="Rparadox")# 1. Open the file and get a handlepxdoc<- pxlib_open_file(db_path)if (!is.null(pxdoc)) {# 2. Get metadata without reading all the datametadata<- pxlib_metadata(pxdoc)  cat("Number of records:",metadata$num_records,"\n")# 3. Read the actual datadata_table<- pxlib_get_data(pxdoc)# 4. Always close the file when you're done  pxlib_close_file(pxdoc)}#> Number of records: 28

Links

About

Rparadox: A Modern Interface for Reading Paradox Databases in R

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp