Table | R Documentation |
Table class for working with tabular data and associated schema. A table is created from a data source and optionally a schema. It provides methods for iteration, reading, inference, validation, and saving of tabular data.
# Table$load(source, schema = NULL, strict = FALSE, headers = 1, ...)
source |
Data source. Can be one of:
|
schema |
Optional. Schema object or schema descriptor as JSON, list, or URL. |
strict |
Logical. If |
headers |
Data source headers. Can be:
|
... |
Additional options passed to the CSV parser.
See CSV Parser Options. By default, |
R6Class
object.
Object of class R6Class
.
Table$new(source, schema, strict, headers)
Use Table$load
to instantiate a Table object.
iter(keyed, extended, cast = TRUE, relations = FALSE, stream = FALSE)
Iterates over table rows.
keyed
Logical. Whether to return rows as named lists.
extended
Logical. Whether to include row metadata.
cast
Logical. Whether to cast data to schema types.
relations
List of foreign key references (named list of resource names with reference rows).
stream
Logical. Return an R stream if TRUE
.
read(keyed, extended, cast = TRUE, relations = FALSE, limit)
Reads and returns the entire table as rows.
keyed
Logical. Whether to return keyed rows.
extended
Logical. Whether to include row metadata.
cast
Logical. Whether to cast values.
relations
List of foreign key references (see iter
).
limit
Integer. Maximum number of rows to return.
infer(limit = 100)
Infers the schema from the data.
limit
Integer. Number of rows to use for inference.
save(target)
Saves the table as a CSV file.
target
File path to save to.
headers
Returns headers detected or provided.
schema
Returns the associated Schema instance.
A table is a fundamental concept in tabular data management. It represents rows and columns of structured data, often accompanied by a schema (metadata describing field types, constraints, etc.).
The physical representation of a table refers to the raw data (e.g., in CSV or JSON form). The logical representation corresponds to the parsed and typed values conforming to schema definitions.
This class supports both representations, applying validation, constraint checking, and conversion between them.
Internally, the package uses:
jsonlite for JSON parsing to and from R lists.
future for asynchronous loading (e.g., future::value(future_obj)
).
See the examples in function documentation for how to use these features with 'tableschema.r'.
The key words MUST
, MUST NOT
, REQUIRED
, SHALL
, SHALL NOT
,
SHOULD
, SHOULD NOT
, RECOMMENDED
, MAY
, and OPTIONAL
in this documentation are interpreted as described in RFC 2119.
Table$load
,
Table Schema Specifications
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.