Skip to contents

This function reads an RCDF (Reusable Data Container Format) archive, decrypts its contents using the specified decryption key, and loads it into R as an RCDF object. The data files within the archive (usually Parquet files) are decrypted and, if provided, metadata (such as data dictionary and value sets) are applied to the data.

Usage

read_rcdf(path, decryption_key, ..., password = NULL, metadata = NULL)

Arguments

path

A string specifying the path to the RCDF archive (zip file).

decryption_key

The key used to decrypt the RCDF contents. This can be an RSA or AES key, depending on how the RCDF was encrypted.

...

Additional parameters passed to other functions, if needed.

password

A password used for RSA decryption (optional).

metadata

An optional metadata object containing data dictionaries and value sets. This metadata is applied to the data if provided.

Value

An RCDF object, which is a list of Parquet files (one for each record) along with attached metadata.

Examples

dir <- system.file("extdata", package = "rcdf")
rcdf_path <- file.path(dir, 'mtcars.rcdf')
private_key <- file.path(dir, 'sample-private-key.pem')

rcdf_data <- read_rcdf(path = rcdf_path, decryption_key = private_key)
rcdf_data
#> $mtcars
#> Table
#> 32 rows x 11 columns
#> $mpg <double>
#> $cyl <double>
#> $disp <double>
#> $hp <double>
#> $drat <double>
#> $wt <double>
#> $qsec <double>
#> $vs <double>
#> $am <double>
#> $gear <double>
#> $carb <double>
#> 
#> See $metadata for additional Schema metadata
#> 
#> attr(,"metadata")
#> attr(,"metadata")$log_id
#> [1] "cd2c7923-b59a-45d4-a229-ece2a7d08b39"
#> 
#> attr(,"metadata")$key_app
#> [1] "QnNixka1a8HbTUS7/rUfPWpFMj5/Dqw7WuDbJ2Fdzko6kKQEtFArJB+KqJ+slZb14cXhstc8Qjt9tUuS5IxTS5rq3JAlei6wInB05Jv1qqp6jtv+/soVxid7oiUxRfOLbguk9WSigoAecJn6qQHwhRYrN4vLs/FvOHYO6h0SfKJBvZekil9mVJLayY7AusN09LQIm36ZOdi4mNpvmvaZwmLwBUdIocd/c57smGCZODU0R4byT6OjHkNP9QesvuNVpyuDEALoA7tzNdDiKjVTBRbEeTkXRb6lnM6PybL0FYaQiBoDPItiWTmjQEiZSzDZo5DREqoymq0LFN4MrxJ+dA=="
#> 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a3Z5M0XBD+w1PtIqmh3jsY5oxW6hG7ug+ZaXHQ=="
#> 
#> attr(,"metadata")$pc_os
#> [1] "darwin"
#> 
#> attr(,"metadata")$pc_os_release_date
#> [1] "Tue Apr 22 19:54:49 PDT 2025"
#> 
#> attr(,"metadata")$pc_os_version
#> [1] "24.5.0"
#> 
#> attr(,"metadata")$pc_hardware
#> [1] "arm64"
#> 
#> attr(,"metadata")$created_at
#> [1] "2025-08-23 13:03:40"
#> 
#> attr(,"metadata")$version
#> [1] 1
#> 
#> attr(,"metadata")$checksum
#>             file                            value
#> 1 mtcars.parquet e89abe4f7eab505621a99fda1eb8cc2f
#> 
#> attr(,"metadata")$dir
#> [1] "/tmp/RtmpWGXC1Q/__rcdf_temp__/mtcars"
#> 
#> attr(,"class")
#> [1] "list" "rcdf"

# Using encrypted/password protected private key
rcdf_path_pw <- file.path(dir, 'mtcars-pw.rcdf')
private_key_pw <- file.path(dir, 'sample-private-key-pw.pem')
pw <- '1234'

rcdf_data_with_pw <- read_rcdf(
  path = rcdf_path_pw,
  decryption_key = private_key_pw,
  password = pw
)

rcdf_data_with_pw
#> $mtcars
#> Table
#> 32 rows x 11 columns
#> $mpg <double>
#> $cyl <double>
#> $disp <double>
#> $hp <double>
#> $drat <double>
#> $wt <double>
#> $qsec <double>
#> $vs <double>
#> $am <double>
#> $gear <double>
#> $carb <double>
#> 
#> See $metadata for additional Schema metadata
#> 
#> attr(,"metadata")
#> attr(,"metadata")$log_id
#> [1] "8c20de9d-3bd8-4f34-8548-7081a769ff57"
#> 
#> attr(,"metadata")$key_app
#> [1] "JkcnTsjt/qp0W+5SESZVDS0qZdsGWiQTFc9v/RgcnuEbHCfyRx22WbeYsSPlAczXvN5NcIOWT0ZXEolBlW5EGfCUn8NkHOrzH3qXD7x/bJKHDGx5fv8imYKyeZYgndIA1BiEU04jiOcYeUsVIJmPvpjp3fNvbmWyBnaw1iYQh/Kr19Gvye+8dgpALswXdhXSq7mfs+dZo546MhxSWiH1LCvMJ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yk1x0h5tvCcHuGIlLeFxEIeGldl4I64mlADX9lEZ+VbmIMbye0DrqbA13YfvGnmYhuRFWOo32odBqZ+4dkCdzClRc5gWlQTP3YftEKKOWg00L88fEpiZUCK7Jv29D5+yAPZTnAtI0JvAH3TAuWYUa9fmxKL/bTKBUBuF8naInQl1A=="
#> 
#> attr(,"metadata")$pc_os
#> [1] "darwin"
#> 
#> attr(,"metadata")$pc_os_release_date
#> [1] "Tue Apr 22 19:54:49 PDT 2025"
#> 
#> attr(,"metadata")$pc_os_version
#> [1] "24.5.0"
#> 
#> attr(,"metadata")$pc_hardware
#> [1] "arm64"
#> 
#> attr(,"metadata")$created_at
#> [1] "2025-08-23 13:03:48"
#> 
#> attr(,"metadata")$version
#> [1] 1
#> 
#> attr(,"metadata")$checksum
#>             file                            value
#> 1 mtcars.parquet 9534342a18251e405704905deed9ba0f
#> 
#> attr(,"metadata")$dir
#> [1] "/tmp/RtmpWGXC1Q/__rcdf_temp__/mtcars-pw"
#> 
#> attr(,"class")
#> [1] "list" "rcdf"