| Title: | Transportation Infrastructure Data Toolbox |
| Version: | 0.1.0 |
| Author: | Vilmar Faustino do Nascimento [aut, cre], Carlos David Rodrigues Melo [aut], Nelson de Oliveira Quesado Filho [aut], Jorge Barbosa Soares [con] |
| Maintainer: | Vilmar Faustino do Nascimento <vilmarfaustinok@gmail.com> |
| Description: | An open-source toolbox for storing, validating, managing, and exploring transportation infrastructure data. Provides a relational data model for binders, aggregates, mixtures, and test results, with a human-readable file format (.pavdata) aligned with FAIR principles. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.0) |
| Imports: | jsonlite, uuid, graphics |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-06-13 17:31:51 UTC; nelsonquesado |
| Repository: | CRAN |
| Date/Publication: | 2026-06-19 16:00:02 UTC |
Test whether an object is a PavData object
Description
Test whether an object is a PavData object
Usage
is.pavdata(x)
Arguments
x |
Any R object. |
Value
A single logical value: TRUE if x is a PavData object,
FALSE otherwise.
Examples
is.pavdata(pav_new("sample", name = "Am_001"))
Validate a single PavData object
Description
Checks a PavData object for required fields (level 1) and for values outside physically plausible ranges (level 2). Missing optional fields do not cause failure.
Usage
pav_check(x, verbose = TRUE)
Arguments
x |
A PavData object created by |
verbose |
Logical; if |
Value
Invisibly, a list with valid (logical) and issues
(a character vector of messages).
Examples
pav_check(pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70"))
Check relational integrity of a collection
Description
Validates every object in a collection and verifies that reference fields (foreign keys) point to existing objects, reporting failed objects and broken references.
Usage
pav_check_integrity(objects, verbose = TRUE)
Arguments
objects |
A named list of PavData objects, as returned by
|
verbose |
Logical; if |
Value
Invisibly, a list with valid (logical), total,
failed and broken_refs.
Examples
b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70")
pav_check_integrity(list(b))
Create a PavData library
Description
Creates an empty in-memory library to store, index and query PavData objects.
Usage
pav_library()
Value
A pav_library object (an environment) with an empty object
store and type index.
Examples
lib <- pav_library()
Load a .pavdata file into a library
Description
Reads a .pavdata file and adds all of its objects to an existing
library, updating the type index.
Usage
pav_library_load(lib, path)
Arguments
lib |
A |
path |
Character string with the path to a |
Value
The library lib, invisibly.
Examples
b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70")
tmp <- tempfile(fileext = ".pavdata")
pav_write(b, tmp)
lib <- pav_library()
pav_library_load(lib, tmp)
List objects in a library
Description
Lists objects stored in a library, optionally filtered by type, by a substring of the name, or by binder type, up to a maximum number of results.
Usage
pav_list(
lib,
type = NULL,
name_contains = NULL,
binder_type = NULL,
limit = 20
)
Arguments
lib |
A |
type |
Character string with an object type to filter by, or
|
name_contains |
Character string matched against object names
(case-insensitive), or |
binder_type |
Character string with a binder type to filter by, or
|
limit |
Integer; maximum number of objects to return (default 20). |
Value
Invisibly, a list with the matching objects.
Examples
b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70")
tmp <- tempfile(fileext = ".pavdata")
pav_write(b, tmp)
lib <- pav_library()
pav_library_load(lib, tmp)
pav_list(lib, type = "binder")
Read and validate a .pavdata file
Description
Reads a .pavdata file with pav_read and then validates
each object, warning if any fail validation.
Usage
pav_load(path)
Arguments
path |
Character string with the path to a |
Value
A named list of PavData objects, keyed by object id.
Examples
b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70")
tmp <- tempfile(fileext = ".pavdata")
pav_write(b, tmp)
objects <- pav_load(tmp)
Create a PavData object
Description
Constructs a PavData object of a given type, attaching the common metadata (id, name, type, version, creation timestamp, source, references, notes and history) shared by all object types.
Usage
pav_new(object_type, ...)
Arguments
object_type |
Character string with the object type. One of
|
... |
Named arguments with the type-specific fields (for example,
|
Value
A PavData object: a list with S3 classes pavdata_<type>,
pavdata_object and list.
Examples
b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70")
m <- pav_new("mixture", name = "Mixture 1", binder_id = b$id,
aggregate_id = "agg_001")
Read a .pavdata file
Description
Reads a .pavdata file and reconstructs the PavData objects, restoring
their S3 classes and indexing them by id.
Usage
pav_read(path)
Arguments
path |
Character string with the path to a |
Value
A named list of PavData objects, keyed by object id.
Examples
b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70")
tmp <- tempfile(fileext = ".pavdata")
pav_write(b, tmp)
objects <- pav_read(tmp)
View the details of an object
Description
Prints the metadata and the filled fields of a single object stored in a library, including its non-empty nested values.
Usage
pav_view(lib, id)
Arguments
lib |
A |
id |
Character string with the id of the object to view. |
Value
Invisibly, the object, or NULL if it is not found.
Examples
b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70")
tmp <- tempfile(fileext = ".pavdata")
pav_write(b, tmp)
lib <- pav_library()
pav_library_load(lib, tmp)
pav_view(lib, b$id)
Write PavData objects to a .pavdata file
Description
Serializes one or more PavData objects to a .pavdata file (JSON
content), grouping them by type. The .pavdata extension is appended
when missing.
Usage
pav_write(x, path, pretty = TRUE)
Arguments
x |
A single PavData object or a list of PavData objects. |
path |
Character string with the output file path. |
pretty |
Logical; if |
Value
The output path, invisibly.
Examples
b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70")
tmp <- tempfile(fileext = ".pavdata")
pav_write(b, tmp)
Path to the bundled example dataset
Description
Returns the file path to the example .pavdata dataset shipped with the
package (296 Brazilian asphalt mixture records).
Usage
pavdata_sample_path()
Value
A character string with the full path to the dataset file, or an empty string if the package is not installed.
Examples
path <- pavdata_sample_path()
Get the type of a PavData object
Description
Get the type of a PavData object
Usage
pavdata_type(x)
Arguments
x |
A PavData object created by |
Value
A character string with the object type (for example,
"binder"), taken from its S3 class.
Examples
pavdata_type(pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70"))