Overview
ATable is a sequence of chunked arrays. Tables have a similar interface to record batches, but they can be composed from multiple record batches or chunked arrays. Tables are data-frame-like, and many methods you expect to work on a data.frame are implemented for Table.
Table Class
Factory Method
Table$create()
Create a Table from various inputs.A
data.frame, a named set of Arrays or vectors, or RecordBatch objects. If given a mixture of data.frames and named vectors, the inputs will be autospliced togetherA Schema, or NULL (the default) to infer the schema from the data
Methods
$column()
Extract aChunkedArray by integer position from the table.
Zero-based column index
$ColumnNames()
Get all column names (called bynames(tab)).
$nbytes()
Total number of bytes consumed by the elements of the table.$RenameColumns()
Set all column names (called bynames(tab) <- value).
New column names
$GetColumnByName()
Extract aChunkedArray by string name.
Column name
$RemoveColumn()
Remove a column by index.Zero-based column index
$AddColumn()
Add a new column at the specified position.Zero-based position to insert the column
A Field object defining the column name and type
The column data
$SetColumn()
Replace a column at the specified position.Zero-based column index
A Field object defining the column name and type
The column data
$ReplaceSchemaMetadata()
Replace the schema metadata.Named list of metadata
$field()
Extract aField from the table schema by integer position.
Zero-based field index
$SelectColumns()
Return newTable with specified columns.
Zero-based column indices to select
$Slice()
Create a zero-copy view starting at the indicated integer offset.Starting row position (zero-based)
Number of rows to include. If NULL, goes to the end of the table
$Take()
Return aTable with rows at positions given by integers.
Row positions to take. If an Arrow Array or ChunkedArray, it will be coerced to an R vector
$Filter()
Return aTable with rows at positions where logical vector is TRUE.
Logical vector or Arrow boolean-type (Chunked)Array
Whether to keep NA values
$SortIndices()
Return anArray of integer row positions that can be used to rearrange the Table.
Column names to sort by
Whether to sort in descending order. Can be a logical vector of length one or of the same length as
names$serialize()
Write the table to the given OutputStream.The output stream to write to
Additional arguments
$to_data_frame()
Convert the table to an R data.frame.$cast()
Alter the schema of the table.The target schema. Must have the same column names as the current schema
Whether to check for overflows or other unsafe conversions
Casting options
$Equals()
Check if this table is equal to another.Another Table to compare with
Whether to compare metadata as well
$Validate()
Perform validation checks on the table.$ValidateFull()
Perform full validation checks on the table.Active Bindings
$num_columns
Number of columns in the table.$num_rows
Number of rows in the table.$schema
The Schema of the table. Can be read or replaced.$columns
Returns a list ofChunkedArrays.
$metadata
Returns the key-value metadata of the Schema as a named list. Modify or replace by assigning in.S3 Methods
Tables support many data.frame-like operations:Subsetting
names(), dim(), nrow(), ncol()
head() and tail()
Helper Functions
arrow_table()
Alias forTable$create().
A
data.frame or a named set of Arrays or vectorsA Schema, or NULL to infer from data
as_arrow_table()
Convert a single object to an Arrow Table.An object to convert to an Arrow Table
An optional schema
concat_tables()
Concatenate one or more Tables into a single table. This operation does not copy array data.One or more Table or RecordBatch objects. RecordBatch objects will be automatically converted to Tables
If TRUE, the schemas will be unified with fields of the same name being merged, then each table will be promoted to the unified schema before being concatenated