Skip to contents

Reads the project contract and lists the table files of processProject() that exist under path.tables, reading each one as its step wrote it to report its rows, columns and key. It writes nothing.

Usage

listProjectTables(file, root)

Arguments

file

Path of the JSON contract, resolved against root when it is relative.

root

Existing project root against which the contract and its paths are resolved.

Value

A data.table with one row per table file, in the order in which processProject() publishes them, and the columns table, step (the step that publishes it), siteID (NA for a global table), path (the file spelled from path.tables as the contract declares it, as in the effects record of processProject()), bytes (the size of the file), rows (the rows of the table it holds), columns and key (list columns: the column names of that table, and its key columns, empty when it has none) and date (the modification time of the file). Without tables, the table has these columns and no rows.

Details

The tables are the files at the destinations of processProject(): ShearTable.Rds, DnPlotTable.Rds, DnTable.Rds and kmaxTable.Rds at the root of path.tables, and DnDraws.Rds, PGATable.csv, DnTable.Rds and kmaxTable.Rds under <ID.gmdp>/<siteID>/ for every directory there whose name is a site identifier (a letter followed by letters, digits, _ or -). A destination without its file is not listed, and neither is any other file. A contract without ID.gmdp, as one for the ShearTable step alone may be, has global tables only. The contract is read and checked, and its paths resolved against root, as processProject() does. The RDS files are read with readRDS() and PGATable.csv with data.table::fread() and TR numeric, as the kmaxTable step reads it back; a table file that cannot be read, or that holds no table, stops the listing naming it.

Examples

Root <- file.path(tempdir(), "newmarkProducts")
dir.create(Root)
writeLines('{"path": {"tables": "data/newmark"}, "Vref.gmdp": 760,
  "Hs": [10, 12], "lo.min": 0.35, "lo.max": 0.075, "s.min": 2.5, "s.max": 3.5,
  "uscs": {"U1": ["ML", "MH"]}, "IDm": ["U1"], "seed": 20260915}',
  file.path(Root, "newmark.json"))
listProjectTables("newmark.json", root = Root)
#> Empty data.table (0 rows and 9 cols): table,step,siteID,path,bytes,rows...
# \donttest{
processProject(root = Root, steps = "ShearTable")
#> ShearTable wrote ShearTable (18 rows, seed 20260915)
listProjectTables("newmark.json", root = Root)
#>         table       step siteID                        path bytes  rows
#>        <char>     <char> <char>                      <char> <num> <int>
#> 1: ShearTable ShearTable   <NA> data/newmark/ShearTable.Rds  1102    18
#>                        columns    key                date
#>                         <list> <list>              <POSc>
#> 1: Hs,b,s,Vref,IDm,IDg,...[19]        2026-10-25 07:56:35
# }
unlink(Root, recursive = TRUE)