Tables are data-frame-like, and many methods you expect to work on
data.frame are implemented for
Table. This includes
tail. You can also pull
the data from an Arrow table into R with
as.data.frame(). See the
A caveat about the
$ method: because
Table is an
$ is also used to access the object's methods (see below). Methods take
precedence over the table's columns. So,
tab$Slice would return the
"Slice" method function even if there were a column in the table called
In addition to the more R-friendly S3 methods, a
Table object has
the following R6 methods that map onto the underlying C++ methods:
$column(i): Extract a
ChunkedArrayby integer position from the table
$ColumnNames(): Get all column names (called by
$nbytes(): Total number of bytes consumed by the elements of the table
$RenameColumns(value): Set all column names (called by
names(tab) <- value)
$GetColumnByName(name): Extract a
ChunkedArrayby string name
$field(i): Extract a
Fieldfrom the table schema by integer position
$SelectColumns(indices): Return new
Tablewith specified columns, expressed as 0-based integers.
$Slice(offset, length = NULL): Create a zero-copy view starting at the indicated integer offset and going for the given length, or to the end of the table if
NULL, the default.
$Take(i): return an
Tablewith rows at positions given by integers
iis an Arrow
ChunkedArray, it will be coerced to an R vector before taking.
$Filter(i, keep_na = TRUE): return an
Tablewith rows at positions where logical vector or Arrow boolean-type
$SortIndices(names, descending = FALSE): return an
Arrayof integer row positions that can be used to rearrange the
Tablein ascending or descending order by the first named column, breaking ties with further named columns.
descendingcan be a logical vector of length one or of the same length as
$serialize(output_stream, ...): Write the table to the given OutputStream
$cast(target_schema, safe = TRUE, options = cast_options(safe)): Alter the schema of the record batch.
There are also some active bindings:
$metadata: Returns the key-value metadata of the
Schemaas a named list. Modify or replace by assigning in (
tab$metadata <- new_metadata). All list elements are coerced to string. See
schema()for more information.
$columns: Returns a list of