Rparadox provides a simple and efficient way to read
data from Paradox database files (.db
) directly into R as
modern tibble
data frames. It uses the underlying
pxlib
C library to handle the low-level file 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 its
associated BLOB/memo file (.mb
).
.db
files without needing database drivers or external software.tibble
format, which is fully compatible with the Tidyverse
ecosystem..mb
)
files.Date
,
Time
(hms
), Timestamp
(POSIXct
), Logical
, Integer
,
Numeric
, and binary blob
objects.You can install the development version of Rparadox from GitHub using
the devtools
package.
# install.packages("devtools")
::install_github("celebithil/Rparadox") devtools
Using the package involves two main functions:
pxlib_open_file()
to open a connection to the database and
pxlib_get_data()
to read the data. The connection is then
closed with pxlib_close_file()
.
This example reads a simple Paradox file included with the package. The code below is executed live when this README is generated, ensuring the output is always accurate.
# 1. Load the package
library(Rparadox)
# 2. Get the path to an example database
<- system.file("extdata", "biolife.db", package = "Rparadox")
db_path
# 3. Open the file
# This automatically finds and attaches the 'biolife.mb' BLOB file.
<- pxlib_open_file(db_path)
pxdoc
# 4. Read the data into a tibble
if (!is.null(pxdoc)) {
<- pxlib_get_data(pxdoc)
biolife_data
# 5. Always close the file when you're done
pxlib_close_file(pxdoc)
# 6. View the data
print(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>
If you have a legacy file where the encoding is specified incorrectly
in the header (e.g., it says ASCII but is actually CP866), you can
manually override it using the encoding
parameter.
# This tells the package to interpret the source data as CP866
<- pxlib_open_file("path/to/your/file.db", encoding = "cp866")
pxdoc
# The rest of the process is the same
<- pxlib_get_data(pxdoc)
data pxlib_close_file(pxdoc)
This ensures that all text fields are correctly converted to UTF-8 in
the final tibble
.