| Title: | Transportation Infrastructure Data Toolbox |
|---|---|
| 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. |
| Authors: | 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 <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-20 08:49:16 UTC |
| Source: | https://github.com/cran/pavdata |
Test whether an object is a PavData object
is.pavdata(x)is.pavdata(x)
x |
Any R object. |
A single logical value: TRUE if x is a PavData object,
FALSE otherwise.
is.pavdata(pav_new("sample", name = "Am_001"))is.pavdata(pav_new("sample", name = "Am_001"))
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.
pav_check(x, verbose = TRUE)pav_check(x, verbose = TRUE)
x |
A PavData object created by |
verbose |
Logical; if |
Invisibly, a list with valid (logical) and issues
(a character vector of messages).
pav_check(pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70"))pav_check(pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70"))
Validates every object in a collection and verifies that reference fields (foreign keys) point to existing objects, reporting failed objects and broken references.
pav_check_integrity(objects, verbose = TRUE)pav_check_integrity(objects, verbose = TRUE)
objects |
A named list of PavData objects, as returned by
|
verbose |
Logical; if |
Invisibly, a list with valid (logical), total,
failed and broken_refs.
b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70") pav_check_integrity(list(b))b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70") pav_check_integrity(list(b))
Creates an empty in-memory library to store, index and query PavData objects.
pav_library()pav_library()
A pav_library object (an environment) with an empty object
store and type index.
lib <- pav_library()lib <- pav_library()
Reads a .pavdata file and adds all of its objects to an existing
library, updating the type index.
pav_library_load(lib, path)pav_library_load(lib, path)
lib |
A |
path |
Character string with the path to a |
The library lib, invisibly.
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)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)
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.
pav_list( lib, type = NULL, name_contains = NULL, binder_type = NULL, limit = 20 )pav_list( lib, type = NULL, name_contains = NULL, binder_type = NULL, limit = 20 )
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). |
Invisibly, a list with the matching objects.
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")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")
Reads a .pavdata file with pav_read and then validates
each object, warning if any fail validation.
pav_load(path)pav_load(path)
path |
Character string with the path to a |
A named list of PavData objects, keyed by object id.
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)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)
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.
pav_new(object_type, ...)pav_new(object_type, ...)
object_type |
Character string with the object type. One of
|
... |
Named arguments with the type-specific fields (for example,
|
A PavData object: a list with S3 classes pavdata_<type>,
pavdata_object and list.
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")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")
Reads a .pavdata file and reconstructs the PavData objects, restoring
their S3 classes and indexing them by id.
pav_read(path)pav_read(path)
path |
Character string with the path to a |
A named list of PavData objects, keyed by object id.
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)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)
Prints the metadata and the filled fields of a single object stored in a library, including its non-empty nested values.
pav_view(lib, id)pav_view(lib, id)
lib |
A |
id |
Character string with the id of the object to view. |
Invisibly, the object, or NULL if it is not found.
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)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)
Serializes one or more PavData objects to a .pavdata file (JSON
content), grouping them by type. The .pavdata extension is appended
when missing.
pav_write(x, path, pretty = TRUE)pav_write(x, path, pretty = TRUE)
x |
A single PavData object or a list of PavData objects. |
path |
Character string with the output file path. |
pretty |
Logical; if |
The output path, invisibly.
b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70") tmp <- tempfile(fileext = ".pavdata") pav_write(b, tmp)b <- pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70") tmp <- tempfile(fileext = ".pavdata") pav_write(b, tmp)
Returns the file path to the example .pavdata dataset shipped with the
package (296 Brazilian asphalt mixture records).
pavdata_sample_path()pavdata_sample_path()
A character string with the full path to the dataset file, or an empty string if the package is not installed.
path <- pavdata_sample_path()path <- pavdata_sample_path()
Get the type of a PavData object
pavdata_type(x)pavdata_type(x)
x |
A PavData object created by |
A character string with the object type (for example,
"binder"), taken from its S3 class.
pavdata_type(pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70"))pavdata_type(pav_new("binder", name = "CAP 50/70", binder_type = "CAP 50/70"))