| Title: | R6 Classes for TileDB Arrays and Groups |
|---|---|
| Description: | Provides foundational R6 classes to interface with 'TileDB' storage engine using 'tiledb' package. The goal is to offer a set of minimum classes based on the R6 object oriented system in order to make it easier to work with 'TileDB' Arrays and Groups. The base classes 'TileDBArray' and 'TileDBGroup' can be easily extended to new subclasses to represent and support any data model. |
| Authors: | Constantinos Giachalis [aut, cre], TileDB, Inc [ctb] (Initial code and tests for R6 classes from 'TileDB-SOMA/apis/r' GitHub repo.) |
| Maintainer: | Constantinos Giachalis <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.4 |
| Built: | 2026-10-13 12:14:57 UTC |
| Source: | https://github.com/cgiachalis/R6.tiledb |
Get Array Timestamps
## S3 method for class 'tiledb_array' array_timestamps(object, tz = "", ...) ## S3 method for class 'TileDBArray' array_timestamps(object, tz = "", ...)## S3 method for class 'tiledb_array' array_timestamps(object, tz = "", ...) ## S3 method for class 'TileDBArray' array_timestamps(object, tz = "", ...)
object |
An |
tz |
A character string for the time zone specification to be used
for the conversion in print method only. Defaults to |
... |
Other arguments passed to methods. Not used. |
An object of class array_timestamps that is a list that
holds the user supplied temporal timestamps and the time range the array
is opened at.
group_timestamps(), set_tiledb_timestamp()
Close a tiledb::tiledb_array(), tiledb::tiledb_group(), TileDBArray
or TileDBGroup object.
## S3 method for class 'tiledb_array' close(con, ...) ## S3 method for class 'TileDBArray' close(con, ...) ## S3 method for class 'tiledb_group' close(con, ...) ## S3 method for class 'TileDBGroup' close(con, ...)## S3 method for class 'tiledb_array' close(con, ...) ## S3 method for class 'TileDBArray' close(con, ...) ## S3 method for class 'tiledb_group' close(con, ...) ## S3 method for class 'TileDBGroup' close(con, ...)
con |
An |
... |
Other arguments passed to methods. Not used. |
Invisibly, a logical TRUE on success.
Delete metadata using keys names for a TileDB array or group.
## S3 method for class 'TileDBArray' delete_metadata(x, keys, ...) ## S3 method for class 'TileDBGroup' delete_metadata(x, keys, ...) ## S3 method for class 'tiledb_array' delete_metadata(x, keys, ...) ## S3 method for class 'tiledb_group' delete_metadata(x, keys, ...) ## S3 method for class 'character' delete_metadata(x, keys, ctx = NULL, ...)## S3 method for class 'TileDBArray' delete_metadata(x, keys, ...) ## S3 method for class 'TileDBGroup' delete_metadata(x, keys, ...) ## S3 method for class 'tiledb_array' delete_metadata(x, keys, ...) ## S3 method for class 'tiledb_group' delete_metadata(x, keys, ...) ## S3 method for class 'character' delete_metadata(x, keys, ctx = NULL, ...)
x |
An |
keys |
A character vector of metadata key names to be accessed. |
... |
Other arguments passed to methods. Not used. |
ctx |
Optional |
delete_metadata() works similar to metadata<-() with NULL value
but works with a character vector of keys.
The character method requires a valid URI path.
The methods will not alter the mode of the TileDB object; also, the object
will be opened temporarily to access the metadata if it is closed.
A logical TRUE, invisibly.
set_metadata() and metadata().
UCBAdmissions datasetCreate a demo array for UCBAdmissions dataset
demo_array_UCBAdmissions(uri)demo_array_UCBAdmissions(uri)
uri |
The uri path. |
Fetch metadata using a list of key-value pairs for a TileDB array or group.
Optionally, you can access metadata at specific point in time
(time-travelling).
## S3 method for class 'TileDBArray' fetch_metadata(x, keys = NULL, timestamp = NULL, ...) ## S3 method for class 'TileDBGroup' fetch_metadata(x, keys = NULL, timestamp = NULL, ...) ## S3 method for class 'tiledb_array' fetch_metadata(x, keys = NULL, timestamp = NULL, ...) ## S3 method for class 'tiledb_group' fetch_metadata(x, keys = NULL, timestamp = NULL, ...) ## S3 method for class 'character' fetch_metadata(x, keys = NULL, timestamp = NULL, ctx = NULL, ...)## S3 method for class 'TileDBArray' fetch_metadata(x, keys = NULL, timestamp = NULL, ...) ## S3 method for class 'TileDBGroup' fetch_metadata(x, keys = NULL, timestamp = NULL, ...) ## S3 method for class 'tiledb_array' fetch_metadata(x, keys = NULL, timestamp = NULL, ...) ## S3 method for class 'tiledb_group' fetch_metadata(x, keys = NULL, timestamp = NULL, ...) ## S3 method for class 'character' fetch_metadata(x, keys = NULL, timestamp = NULL, ctx = NULL, ...)
x |
An |
keys |
A character vector of metadata key names to be accessed. When
|
timestamp |
Optional datetime object of class |
... |
Other arguments passed to methods. Not used. |
ctx |
Optional |
fetch_metadata() works similar to metadata() but works with
a list of key value pairs and returns a list always.
The character method requires a valid URI path.
The methods will not alter the mode of the TileDB object; also, the object
will be opened temporarily to access the metadata if it is closed.
A named list of class tdb_metadata.
set_metadata() and metadata().
Get Group Timestamps
## S3 method for class 'tiledb_ctx' group_timestamps(object, tz = "", ...) ## S3 method for class 'tiledb_group' group_timestamps(object, tz = "", ...) ## S3 method for class 'tiledb_config' group_timestamps(object, tz = "", ...) ## S3 method for class 'TileDBGroup' group_timestamps(object, tz = "", from = c("ctx", "cfg"), ...)## S3 method for class 'tiledb_ctx' group_timestamps(object, tz = "", ...) ## S3 method for class 'tiledb_group' group_timestamps(object, tz = "", ...) ## S3 method for class 'tiledb_config' group_timestamps(object, tz = "", ...) ## S3 method for class 'TileDBGroup' group_timestamps(object, tz = "", from = c("ctx", "cfg"), ...)
object |
An |
tz |
A character string for the time zone specification to be used
for the conversion in print method only. Defaults to |
... |
Other arguments passed to methods. Not used. |
from |
TileDBGroup's source of timestamps: either from context |
An object of class group_timestamps that is a list with
the time range the group is opened at.
array_timestamps(), set_tiledb_timestamp()
Get or set a metadata key for a TileDB array or group.
## S3 method for class 'TileDBArray' metadata(x, which, ...) ## S3 method for class 'TileDBGroup' metadata(x, which, ...) ## S3 method for class 'tiledb_array' metadata(x, which, ...) ## S3 method for class 'tiledb_group' metadata(x, which, ...) ## S3 method for class 'character' metadata(x, which, ctx = NULL, ...) ## S3 replacement method for class 'TileDBArray' metadata(x, which, ...) <- value ## S3 replacement method for class 'TileDBGroup' metadata(x, which, ...) <- value ## S3 replacement method for class 'tiledb_array' metadata(x, which, ...) <- value ## S3 replacement method for class 'tiledb_group' metadata(x, which, ...) <- value ## S3 replacement method for class 'character' metadata(x, which, ctx = NULL, ...) <- value## S3 method for class 'TileDBArray' metadata(x, which, ...) ## S3 method for class 'TileDBGroup' metadata(x, which, ...) ## S3 method for class 'tiledb_array' metadata(x, which, ...) ## S3 method for class 'tiledb_group' metadata(x, which, ...) ## S3 method for class 'character' metadata(x, which, ctx = NULL, ...) ## S3 replacement method for class 'TileDBArray' metadata(x, which, ...) <- value ## S3 replacement method for class 'TileDBGroup' metadata(x, which, ...) <- value ## S3 replacement method for class 'tiledb_array' metadata(x, which, ...) <- value ## S3 replacement method for class 'tiledb_group' metadata(x, which, ...) <- value ## S3 replacement method for class 'character' metadata(x, which, ctx = NULL, ...) <- value
x |
An |
which |
A non-empty character string specifying which metadata key is to be accessed. |
... |
Other arguments passed to methods. Not used. |
ctx |
Optional |
value |
An object, the new value of the metadata, or |
These functions work similar to attr() and provide access to a
single metadata key on an TileDB object. The replacement form (setter)
puts a metadata key with the value specified or creates a new metadata
with the value given.
The character method is intended for a valid URI path.
The methods will not alter the mode of the TileDB object.
For the extractor the object will be opened temporarily to access the metadata if it is closed.
For the replacement, the object will be opened in write mode temporarily and on exit will revert back to previous mode; in the case where the object is already in write mode then it will be reopened at the same mode in order to flush the metadata on disk.
For the extractor, the key value of the metadata matched, or NULL
if no exact match is found.
For a list of metadata and time-travelling use set_metadata() and
fetch_metadata().
Open a URI, tiledb::tiledb_array(), tiledb::tiledb_group(), TileDBArray
or TileDBGroup at write mode with an optional timestamp.
## S3 method for class 'TileDBArray' open_write(object, timestamp = NULL, ctx = NULL, ...) ## S3 method for class 'tiledb_array' open_write(object, timestamp = NULL, ctx = NULL, ...) ## S3 method for class 'TileDBGroup' open_write(object, timestamp = NULL, ctx = NULL, ...) ## S3 method for class 'tiledb_group' open_write(object, timestamp = NULL, ctx = NULL, ...) ## S3 method for class 'character' open_write(object, timestamp = NULL, ctx = NULL, ...)## S3 method for class 'TileDBArray' open_write(object, timestamp = NULL, ctx = NULL, ...) ## S3 method for class 'tiledb_array' open_write(object, timestamp = NULL, ctx = NULL, ...) ## S3 method for class 'TileDBGroup' open_write(object, timestamp = NULL, ctx = NULL, ...) ## S3 method for class 'tiledb_group' open_write(object, timestamp = NULL, ctx = NULL, ...) ## S3 method for class 'character' open_write(object, timestamp = NULL, ctx = NULL, ...)
object |
An |
timestamp |
Optional datetime object of class |
ctx |
Optional |
... |
Other arguments passed to methods. Not used. |
Opening a character string should be a valid URI path for a TileDB resource.
Objects other than a URI character are implicitly closed if found opened and re-opened at write mode.
Note that when using the timestamp argument, the TileDBArray, TileDBGroup
and their subclasses will have different timestamps from the returning TileDB
object. This is by design, you can not write at timestamp using
TileDBArray and TileDBGroup interface only via open_write() method.
An object of class tiledb_array or tiledb_group depending on
the method; the object is opened in ‘WRITE’ mode.
These functions will set or unset the parameters of TileDB Config object and return the modified configuration object.
set_config_params(cfg, keyval) unset_config_params(cfg, keys)set_config_params(cfg, keyval) unset_config_params(cfg, keys)
cfg |
A configuration object |
keyval |
A named character vector with configuration parameters. |
keys |
A character with configuration keys to unset. |
The modified tiledb_config object.
origparams <- c("sm.consolidation.timestamp_start" = "100", "sm.consolidation.timestamp_end" = "20000") # Create a context with a config setting the params above cfg <- tiledb::tiledb_config(origparams) ctx <- tiledb::tiledb_ctx(config = cfg) # Do something with ctx # Get configs from context cfg <- tiledb::config(ctx) # New params params <- c("sm.consolidation.timestamp_start" = "100", "sm.consolidation.timestamp_end" = "10000") cfg <- set_config_params(cfg, params) cfg["sm.consolidation.timestamp_end"] # "10000" # Update context with modified config object ctx <- tiledb::tiledb_ctx(config = cfg) # Reset consolidation timestamps cfg <- unset_config_params(cfg, names(params)) # check the default values cfg["sm.consolidation.timestamp_start"] # "0" cfg["sm.consolidation.timestamp_end"] # "18446744073709551615" # Update context with modified config object ctx <- tiledb::tiledb_ctx(config = cfg)origparams <- c("sm.consolidation.timestamp_start" = "100", "sm.consolidation.timestamp_end" = "20000") # Create a context with a config setting the params above cfg <- tiledb::tiledb_config(origparams) ctx <- tiledb::tiledb_ctx(config = cfg) # Do something with ctx # Get configs from context cfg <- tiledb::config(ctx) # New params params <- c("sm.consolidation.timestamp_start" = "100", "sm.consolidation.timestamp_end" = "10000") cfg <- set_config_params(cfg, params) cfg["sm.consolidation.timestamp_end"] # "10000" # Update context with modified config object ctx <- tiledb::tiledb_ctx(config = cfg) # Reset consolidation timestamps cfg <- unset_config_params(cfg, names(params)) # check the default values cfg["sm.consolidation.timestamp_start"] # "0" cfg["sm.consolidation.timestamp_end"] # "18446744073709551615" # Update context with modified config object ctx <- tiledb::tiledb_ctx(config = cfg)
Set or unset consolidation timestamps to the given configuration object.
set_consolidation_timestamps(cfg, start_time = NULL, end_time = NULL) unset_consolidation_timestamps(cfg)set_consolidation_timestamps(cfg, start_time = NULL, end_time = NULL) unset_consolidation_timestamps(cfg)
cfg |
A configuration object |
start_time, end_time
|
Optional time stamp values. A date time objects
of class |
The modified tiledb_config object.
cfg <- tiledb::tiledb_config() cfg <- set_consolidation_timestamps(cfg, as.POSIXct(1), as.POSIXct(1000)) cfg["sm.consolidation.timestamp_start"] # 1000 (ms) # reset cfg <- unset_consolidation_timestamps(cfg) cfg["sm.consolidation.timestamp_start"] # 0cfg <- tiledb::tiledb_config() cfg <- set_consolidation_timestamps(cfg, as.POSIXct(1), as.POSIXct(1000)) cfg["sm.consolidation.timestamp_start"] # 1000 (ms) # reset cfg <- unset_consolidation_timestamps(cfg) cfg["sm.consolidation.timestamp_start"] # 0
Set or unset group opening start, end timestamps to the given configuration object.
set_group_timestamps(cfg, start_time = NULL, end_time = NULL) unset_group_timestamps(cfg)set_group_timestamps(cfg, start_time = NULL, end_time = NULL) unset_group_timestamps(cfg)
cfg |
A configuration object |
start_time, end_time
|
Optional time stamp values. A date time objects
of class |
The modified tiledb_config object.
cfg <- tiledb::tiledb_config() cfg <- set_group_timestamps(cfg, as.POSIXct(1), as.POSIXct(1000)) cfg["sm.group.timestamp_start"] # 1000 (ms) # reset cfg <- unset_group_timestamps(cfg) cfg["sm.group.timestamp_start"] # 0cfg <- tiledb::tiledb_config() cfg <- set_group_timestamps(cfg, as.POSIXct(1), as.POSIXct(1000)) cfg["sm.group.timestamp_start"] # 1000 (ms) # reset cfg <- unset_group_timestamps(cfg) cfg["sm.group.timestamp_start"] # 0
Set metadata using a list of key-value pairs for a TileDB array or group.
Optionally, you can write metadata at specific point in time
(time-travelling).
## S3 method for class 'TileDBArray' set_metadata(x, keys, timestamp = NULL, ...) ## S3 method for class 'TileDBGroup' set_metadata(x, keys, timestamp = NULL, ...) ## S3 method for class 'tiledb_array' set_metadata(x, keys, timestamp = NULL, ...) ## S3 method for class 'tiledb_group' set_metadata(x, keys, timestamp = NULL, ...) ## S3 method for class 'character' set_metadata(x, keys, timestamp = NULL, ctx = NULL, ...)## S3 method for class 'TileDBArray' set_metadata(x, keys, timestamp = NULL, ...) ## S3 method for class 'TileDBGroup' set_metadata(x, keys, timestamp = NULL, ...) ## S3 method for class 'tiledb_array' set_metadata(x, keys, timestamp = NULL, ...) ## S3 method for class 'tiledb_group' set_metadata(x, keys, timestamp = NULL, ...) ## S3 method for class 'character' set_metadata(x, keys, timestamp = NULL, ctx = NULL, ...)
x |
An |
keys |
A named list of key value metadata. |
timestamp |
Optional datetime object of class |
... |
Other arguments passed to methods. Not used. |
ctx |
Optional |
set_metadata() works similar to metadata<-() but works with
a list of key value pairs.
The optional argument timestamp can be used to set metadata at specific
point in time.
The character method requires a valid URI path.
The methods will not alter the mode of the TileDB object.
The object will be opened in write mode temporarily and on exit will revert back to previous mode; in the case where the object is already in write mode then it will be reopened at the same mode in order to flush the metadata on disk.
A logical TRUE, invisibly.
fetch_metadata() and metadata().
TileDB timestampDefine a list of start,end timestamps intended for opening a TileDB
object, either at initialisation or via active field tiledb_timestamp.
set_tiledb_timestamp(start_time, end_time, tz = "")set_tiledb_timestamp(start_time, end_time, tz = "")
start_time, end_time
|
An object coercible to |
tz |
A character string for the time zone specification to be used
for the conversion. Defaults to |
An list object of class tiledb_timestamp.
# Character input set_tiledb_timestamp("2025-01-01", "2025-08-01", tz = "UTC") # Numeric input set_tiledb_timestamp(1000000, 1000000*4, tz = "UTC") # Date end point set_tiledb_timestamp(end_time = as.Date("1990-01-01"), tz = "UTC") # Default set_tiledb_timestamp(tz = "Europe/London") # Invalid: start_time > end_time # set_tiledb_timestamp(start_time = 1, end_time = 0) # Error: `start_time` is greater than `end_time`.# Character input set_tiledb_timestamp("2025-01-01", "2025-08-01", tz = "UTC") # Numeric input set_tiledb_timestamp(1000000, 1000000*4, tz = "UTC") # Date end point set_tiledb_timestamp(end_time = as.Date("1990-01-01"), tz = "UTC") # Default set_tiledb_timestamp(tz = "Europe/London") # Invalid: start_time > end_time # set_tiledb_timestamp(start_time = 1, end_time = 0) # Error: `start_time` is greater than `end_time`.
TileDBArrayExp
Functional interface that initialises a TileDBArrayExp instance and opens
an array object at READ or WRITE mode.
tdb_array(uri, mode = "READ", ctx = NULL, tiledb_timestamp = NULL)tdb_array(uri, mode = "READ", ctx = NULL, tiledb_timestamp = NULL)
uri |
URI path for the |
mode |
Mode to open : either |
ctx |
Optional |
tiledb_timestamp |
Set a
Also, it can be set through active field |
A TileDBArrayExp, R6 object.
ctx : A TileDB Context. See tiledb::tiledb_ctx()
tiledb_timestamp : A TileDB timestamp range that
the resource will be opened at. See set_tiledb_timestamp()
uri : The URI of the TileDB object
mode: Get the mode of the object: one of the following:
"CLOSED", "READ" or "WRITE"
object_type : The TileDB object type: "ARRAY","GROUP" or "INVALID"
object : Access the underlying tiledb::tiledb_array() object. When
used before open() method, the underlying array will be initialised at "READ"
mode and kept open
fragments_object : Access the TileDBFragments instance for this
array
schema_version : Retrieve the schema version for this array
is_sparse : Check array schema for sparsity
size : Directory size
Public Methods
$class()$is_open()$exists()$get_metadata()$set_metadata()$new()$open()$close()$tiledb_array()$schema()$schema_info()$dimensions()$attributes()$dimnames()$attrnames()$colnames()$print()$create()$delete_array()$reopen()$any_enums()$enum_columns()$enum_levels()$has_enumeration()$consolidate()$consolidate_async()$vacuum()$vacuum_async()$consolidate_and_vacuum()$consolidate_and_vacuum_async()$drop_attribute()$frag_num()$frag_to_vacuum()$frag_dump()$frag_uris()$schema_upgrade()$dir_tree()## Not run: uri <- tempdir() # create demo array on disk demo_array_UCBAdmissions(uri) arrobj <- tdb_array(uri) arrobj$object_type #> "ARRAY" arrobj$frag_num() #> 3 arrobj$colnames() #> "Dept" "Gender" "Admit" "Freq" arrobj$has_enumeration() #> Admit Freq #> TRUE FALSE ## End(Not run)## Not run: uri <- tempdir() # create demo array on disk demo_array_UCBAdmissions(uri) arrobj <- tdb_array(uri) arrobj$object_type #> "ARRAY" arrobj$frag_num() #> 3 arrobj$colnames() #> "Dept" "Gender" "Admit" "Freq" arrobj$has_enumeration() #> Admit Freq #> TRUE FALSE ## End(Not run)
Given a TileDB schema, it will create an array and instantiate a
TileDBArrayExp object. The array will be opened at the given mode
and kept opened. It can be accessed via active field $object.
tdb_array_create(uri, sch, mode = "WRITE", ctx = NULL)tdb_array_create(uri, sch, mode = "WRITE", ctx = NULL)
uri |
URI path for the |
sch |
A TileDB schema. See constructor |
mode |
Mode to open: either |
ctx |
A TileDB Context. See |
A TileDBArrayExp, R6 object.
suppressMessages(library(tiledb)) # construct schema schema <- tiledb_array_schema( dom = tiledb_domain(dims = tiledb_dim("id", c(1L, 4L), 4L, "INT32")), attrs = tiledb_attr("model", type = "ASCII")) # uri path uri <- tempfile() # create and open array at WRITE mode arrobj <- tdb_array_create(uri, sch = schema, mode = "WRITE") arrobj$schema_info() arrobj$mode # WRITEsuppressMessages(library(tiledb)) # construct schema schema <- tiledb_array_schema( dom = tiledb_domain(dims = tiledb_dim("id", c(1L, 4L), 4L, "INT32")), attrs = tiledb_attr("model", type = "ASCII")) # uri path uri <- tempfile() # create and open array at WRITE mode arrobj <- tdb_array_create(uri, sch = schema, mode = "WRITE") arrobj$schema_info() arrobj$mode # WRITE
TileDBFragments
Functional interface that initialises a TileDBFragments instance.
tdb_fragments(uri, ctx = NULL)tdb_fragments(uri, ctx = NULL)
uri |
URI path for the |
ctx |
Optional |
A TileDBFragments, R6 object.
uri : The URI of the TileDB object
fragment_info : Get the TileDB Fragment Info object as returned by
tiledb::tiledb_fragment_info.
Public Methods
$class()$frag_num()$frag_uris()$reload_finfo()$to_vacuum()$to_vacuum_num()$delete_fragment_range()$delete_fragment_list()$delete_fragment()$get_ifragment()$get_first_ifragments()$get_last_ifragments()$dump()$print()## Not run: uri <- tempdir() fobj <- demo_array_UCBAdmissions(uri) # Get metadata information for first fragment fobj$get_ifragment(1) ## End(Not run)## Not run: uri <- tempdir() fobj <- demo_array_UCBAdmissions(uri) # Get metadata information for first fragment fobj$get_ifragment(1) ## End(Not run)
TileDBGroupExp
Functional interface that initialises a TileDBGroupExp instance and opens
a group object at READ or WRITE mode.
tdb_group(uri, mode = "READ", ctx = NULL, tiledb_timestamp = NULL)tdb_group(uri, mode = "READ", ctx = NULL, tiledb_timestamp = NULL)
uri |
URI path for the |
mode |
Mode to open : either |
ctx |
Optional |
tiledb_timestamp |
Set a
Also, it can be set through active field |
A TileDBGroupExp, R6 object.
ctx : A TileDB Context. See tiledb::tiledb_ctx()
tiledb_timestamp : A TileDB timestamp range that
the resource will be opened at. See set_tiledb_timestamp()
uri : The URI of the TileDB object
mode: Get the mode of the object: one of the following:
"CLOSED", "READ" or "WRITE"
object_type : The TileDB object type: "ARRAY","GROUP" or "INVALID"
object : Access the underlying tiledb::tiledb_group() object
members: Access the list of group members.
size : Directory size
Public Methods
$new()$class()$is_open()$exists()$get_metadata()$set_metadata()$create()$open()$close()$remove()$delete()$count_members()$get_members_df()$get_member()$set_member()$names()$member_exists()$print()$dump()$has_non_members()$non_members()$prune_non_members()$delete_group()$walk_group()$dir_tree()## Not run: # uri path uri <- tempdir() obj <- TileDBGroup$new(uri) obj$create() obj$close() # new instance newobj <- tdb_group(uri) newobj$is_open() # TRUE newobj$mode # "READ" ## End(Not run)## Not run: # uri path uri <- tempdir() obj <- TileDBGroup$new(uri) obj$create() obj$close() # new instance newobj <- tdb_group(uri) newobj$is_open() # TRUE newobj$mode # "READ" ## End(Not run)
Create a group and instantiate a TileDBGroupExp object. The group will be
opened at the given mode and kept opened. It can be accessed via active field
$object.
tdb_group_create(uri, mode = "WRITE", ctx = NULL)tdb_group_create(uri, mode = "WRITE", ctx = NULL)
uri |
URI path for the |
mode |
Mode to open: either |
ctx |
A TileDB Context. See |
A TileDBGroupExp, R6 object.
# uri path uri <- tempfile() # create and open array at WRITE mode grpobj <- tdb_group_create(uri,mode = "WRITE") grpobj$mode # WRITE grpobj$count_members() # 0# uri path uri <- tempfile() # create and open array at WRITE mode grpobj <- tdb_group_create(uri,mode = "WRITE") grpobj$mode # WRITE grpobj$count_members() # 0
TileDBArray ObjectBase class for representing a TileDB Array.
A new TileDBArray instance is initialized using the new() method:
# uri path uri <- tempdir() # new instance obj <- TileDBArray$new(uri = uri) # does array exist at this uri obj$exists() # FALSE unlink(uri)
An object of class TileDBArray, R6.
TileDBObject -> TileDBArray
objectAccess the underlying tiledb::tiledb_array() object. When
used before open() method, the underlying array will be initialised at "READ"
mode and kept open.
TileDBArray$open()Open TileDB array object for read or write.
This methods opens the underlying tiledb::tiledb_array() object in the
new mode if it is different from the current mode.
When the new mode and current mode is the same, no action is taken.
To force close and then open again use reopen() method.
When a time-stamp is specified, it will be effective in "READ" mode only.
TileDBArray$open(mode = c("READ", "WRITE"))
modeMode to open : either "READ" or "WRITE". Default is "READ".
The object, invisibly.
TileDBArray$close()Close the object.
TileDBArray$close()
The object, invisibly.
TileDBArray$tiledb_array()Return a tiledb::tiledb_array object.
If a query_type not provided then it will be inherited from class
mode; in case the class mode is "CLOSED", then the query type
defaults to "READ".
TileDBArray$tiledb_array(...)
...Optional arguments to pass to tiledb::tiledb_array().
A tiledb::tiledb_array object.
TileDBArray$schema()Retrieve the array schema as TileDB schema.
TileDBArray$schema()
A tiledb::tiledb_array_schema object.
TileDBArray$schema_info()Retrieve schema information.
TileDBArray$schema_info()
A data.frame object with four column schema
information: names, types, status and enum.
TileDBArray$dimensions()Retrieve the array dimensions.
TileDBArray$dimensions()
A named list of tiledb::tiledb_dim objects.
TileDBArray$attributes()Retrieve the array attributes.
TileDBArray$attributes()
A list of tiledb::tiledb_attr objects.
TileDBArray$dimnames()Retrieve dimension names.
TileDBArray$dimnames()
A character vector with the array's dimension names.
TileDBArray$attrnames()Retrieve attribute names.
TileDBArray$attrnames()
A character vector with the array's attribute names.
TileDBArray$colnames()Retrieve the names of all columns, including dimensions and attributes.
TileDBArray$colnames()
A character vector with the array's column names.
TileDBArray$print()Print summary of the array.
TileDBArray$print()
TileDBArray$clone()The objects of this class are cloneable with this method.
TileDBArray$clone(deep = FALSE)
deepWhether to make a deep clone.
TileDBArrayExp ObjectAn enhanced version of TileDBArray with additional methods to operate on the array.
A new TileDBArrayExp instance is initialised using the new() method.
Alternatively use tdb_array() to create a new instance and open the array
at READ mode.
# uri path uri <- tempdir() # new instance obj <- TileDBArrayExp$new(uri = uri) # does array exist at this uri obj$exists() # FALSE unlink(uri)
An object of class TileDBArrayExp, R6.
TileDBObject -> TileDBArray -> TileDBArrayExp
fragments_objectAccess the TileDBFragments instance for this array.
schema_versionRetrieve the schema version for this array.
is_sparseCheck array schema for sparsity.
sizeDirectory size.
TileDBObject$class()TileDBObject$exists()TileDBObject$get_metadata()TileDBObject$initialize()TileDBObject$is_open()TileDBObject$set_metadata()TileDBArray$attributes()TileDBArray$attrnames()TileDBArray$close()TileDBArray$colnames()TileDBArray$dimensions()TileDBArray$dimnames()TileDBArray$open()TileDBArray$print()TileDBArray$schema()TileDBArray$schema_info()TileDBArray$tiledb_array()TileDBArrayExp$create()Create an empty Array with user defined schema.
The array will be opened at the given mode and kept opened; it can
be accessed via active field $object.
TileDBArrayExp$create(sch, mode = "WRITE")
schA TileDB schema. See constructor tiledb::tiledb_array_schema().
modeMode to open: either "READ" or "WRITE" (default).
The object, invisibly.
TileDBArrayExp$delete_array()Delete the array.
TileDBArrayExp$delete_array()
The object, invisibly.
TileDBArrayExp$reopen()Close and reopen the TileDB object in a new mode.
TileDBArrayExp$reopen(mode = c("READ", "WRITE"))
modeNew mode to open the object in; choose from: "READ" or "WRITE".
The object, invisibly.
TileDBArrayExp$any_enums()Checks array for factors (enumerations).
TileDBArrayExp$any_enums()
A boolean. TRUE indicating the array has factors and
FALSE otherwise.
TileDBArrayExp$enum_columns()Retrieve factor columns (attributes).
TileDBArrayExp$enum_columns()
A character vector with factor columns (enumeration attributes).
TileDBArrayExp$enum_levels()Retrieve factor levels for a given attribute.
TileDBArrayExp$enum_levels(x)
xAn attribute name.
A character vector with levels (enumeration values).
TileDBArrayExp$has_enumeration()Check columns for factors.
TileDBArrayExp$has_enumeration()
A logical vector indicating which column (attribute) is encoded as factor (enumeration).
TileDBArrayExp$consolidate()Consolidates the fragments of the array into a single fragment.
TileDBArrayExp$consolidate(mode = c("fragments", "commits", "fragment_meta",
"array_meta"), cfg = NULL, start_time = NULL, end_time = NULL)
modeThe consolidate mode, one of the following:
"fragments": - consolidate all fragments (default)
"commits": - consolidate all commit files
"fragment_meta": - consolidate only fragment metadata footers to a single file
"array_meta": - consolidate array metadata only
cfgA configuration object tiledb::tiledb_config() to override context
configuration except for parameters set by mode, start_time, end_time.
When NULL (default) the configuration parameters will be retrieved from
object's context.
start_time, end_timeOptional time stamp values. A date time objects
of class POSIXt. If not provided, the default values from configuration
object will be used.
TRUE, invisibly.
TileDBArrayExp$consolidate_async()Consolidate fragments of the array into a single fragment asynchronously.
The consolidation will run in a separate R process in a clean environment.
Note this function requires the mirai package.
TileDBArrayExp$consolidate_async(mode = c("fragments", "commits",
"fragment_meta", "array_meta"), cfg = NULL, start_time = NULL,
end_time = NULL)
modeThe consolidate mode, one of the following:
"fragments": - consolidate all fragments (default)
"commits": - consolidate all commit files
"fragment_meta": - consolidate only fragment metadata footers to a single file
"array_meta": - consolidate array metadata only
cfgA configuration object tiledb::tiledb_config() to override context
configuration except for parameters set by mode, start_time, end_time.
When NULL (default) the configuration parameters will be retrieved from
object's context.
start_time, end_timeOptional time stamp values. A date time objects
of class POSIXt. If not provided, the default values from configuration
object will be used.
This function will return a mirai::mirai() object immediately. When it is
resolved, it returns TRUE indicating consolidation success.
TileDBArrayExp$vacuum()Clean up consolidated fragments and array metadata.
TileDBArrayExp$vacuum(mode = c("fragments", "commits", "fragment_meta",
"array_meta"), cfg = NULL)
modeThe vacuum mode, one of the following:
"fragments": - vacuum all fragments (default)
"commits": - vacuum all commit files
"fragment_meta": - vacuum only fragment metadata footers to a single file
"array_meta": - vacuum array metadata only
cfgA configuration object tiledb::tiledb_config() to override context
configuration. When NULL (default) the configuration parameters will be retrieved from
object's context.
TRUE, invisibly.
TileDBArrayExp$vacuum_async()Asynchronously clean up consolidated fragments and array metadata.
The clean up will run in a separate R process in a clean environment.
Note this function requires the mirai package.
TileDBArrayExp$vacuum_async(mode = c("fragments", "commits", "fragment_meta",
"array_meta"), cfg = NULL)
modeThe vacuum mode, one of the following:
"fragments": - vacuum all fragments (default)
"commits": - vacuum all commit files
"fragment_meta": - vacuum only fragment metadata footers to a single file
"array_meta": - vacuum array metadata only
cfgA configuration object tiledb::tiledb_config() to override context
configuration. When NULL (default) the configuration parameters will be retrieved from
object's context.
This function will return a mirai::mirai() object immediately. When it is
resolved, it returns TRUE indicating vacuum success.
TileDBArrayExp$consolidate_and_vacuum()Consolidates and vacuums the fragments.
TileDBArrayExp$consolidate_and_vacuum(mode = c("fragments", "commits",
"fragment_meta", "array_meta"), cfg = NULL, start_time = NULL,
end_time = NULL)
modeThe consolidate and vacuum mode, one of the following:
"fragments": - consolidate all fragments (default)
"commits": - consolidate all commit files
"fragment_meta": - consolidate only fragment metadata footers to a single file
"array_meta": - consolidate array metadata only
cfgA configuration object tiledb::tiledb_config() to override context
configuration except for parameters set by mode, start_time, end_time.
When NULL (default) the configuration parameters will be retrieved from
object's context.
start_time, end_timeOptional time stamp values. A date time objects
of class POSIXt. If not provided, the default values from configuration
object will be used.
TRUE, invisibly.
TileDBArrayExp$consolidate_and_vacuum_async()Consolidate and vacuum fragments asynchronously.
The consolidation and vacuum will run in a separate R process in a clean environment.
Note this function requires the mirai package.
TileDBArrayExp$consolidate_and_vacuum_async(mode = c("fragments", "commits",
"fragment_meta", "array_meta"), cfg = NULL, start_time = NULL,
end_time = NULL)
modeThe consolidate and vacuum mode, one of the following:
"fragments": - consolidate all fragments (default)
"commits": - consolidate all commit files
"fragment_meta": - consolidate only fragment metadata footers to a single file
"array_meta": - consolidate array metadata only
cfgA configuration object tiledb::tiledb_config() to override context
configuration except for parameters set by mode, start_time, end_time.
When NULL (default) the configuration parameters will be retrieved from
object's context.
start_time, end_timeOptional time stamp values. A date time objects
of class POSIXt. If not provided, the default values from configuration
object will be used.
This function will return a mirai::mirai() object immediately. When it is
resolved, it returns TRUE indicating consolidation success.
TileDBArrayExp$drop_attribute()Remove an attribute from array.
TileDBArrayExp$drop_attribute(x)
xAn attribute name.
The object, invisibly.
TileDBArrayExp$frag_num()The number of fragments.
TileDBArrayExp$frag_num()
TileDBArrayExp$frag_to_vacuum()Consolidated fragments to be removed.
TileDBArrayExp$frag_to_vacuum(trunc_uri = TRUE)
trunc_uriTRUE to truncate uri path.
An object of class data.frame with four columns:
Fragment: the fragment index (starts at 1)
start_timestamp: fragment's start time stamp
end_timestamp: fragment's end time stamp
URI: fragment's truncated uri path (fragment name) when
trunc_uri = TRUE (default), otherwise the full uri path
Note that the return object will be of class data.table if the
package is found in your system.
TileDBArrayExp$frag_dump()Dump to console the commit fragments.
TileDBArrayExp$frag_dump()
TileDBArrayExp$frag_uris()Return a data.frame with time stamps and
fragments uris.
TileDBArrayExp$frag_uris(trunc_uri = TRUE)
trunc_uriTRUE to truncate uri path.
An object of class data.frame with four columns:
Fragment: the fragment index (start at 1)
start_timestamp: start time-stamp of when fragment was written
end_timestamp: end time-stamp of when fragment was written
URI: fragment's truncated uri path (fragment name) when
trunc_uri = TRUE (default), otherwise the full uri path
Note that the return object will be of class data.table if the
package is found in your system.
TileDBArrayExp$schema_upgrade()Upgrade the array to the latest format version.
TileDBArrayExp$schema_upgrade(cfg = NULL, ctx = NULL)
cfgA configuration object tiledb::tiledb_config().
ctxOptional tiledb::tiledb_ctx() object. By default, object's context
is used.
TileDBArrayExp$dir_tree()Print directory contents.
TileDBArrayExp$dir_tree(recursive = TRUE)
recursiveShould it recurse fully? Defaults to TRUE.
A character vector with file paths, invisibly.
TileDBArrayExp$clone()The objects of this class are cloneable with this method.
TileDBArrayExp$clone(deep = FALSE)
deepWhether to make a deep clone.
TileDBFragments ObjectA class for working with TileDB Fragments.
A new TileDBFragments instance is initialised using the new() method or
with the functional interface tdb_fragments().
An object of class TileDBFragments, R6.
uriThe URI of the TileDB object.
fragment_infoGet the TileDB Fragment Info object as returned by tiledb::tiledb_fragment_info.
TileDBFragments$new()Create a new TileDBFragments instance.
TileDBFragments$new(uri, ctx = NULL)
uriURI path for the TileDB Array.
ctxOptional tiledb::tiledb_ctx() object.
TileDBFragments$class()Print the name of the R6 class.
TileDBFragments$class()
TileDBFragments$frag_num()Get the number of fragments.
TileDBFragments$frag_num()
A numeric value.
TileDBFragments$frag_uris()Return a data.frame with time stamps and
fragments uris.
TileDBFragments$frag_uris(trunc_uri = TRUE)
trunc_uriTRUE for fragment name in the form: __ts1_ts2_<label>_<ver>,
otherwise FALSE for full path.
An object of class data.frame with four columns:
Fragment: the fragment index (start at 1)
start_timestamp: start time-stamp of when fragment was written
end_timestamp: end time-stamp of when fragment was written
URI: fragment's truncated uri path (fragment name) when
trunc_uri = TRUE (default), otherwise the full uri path
Note that the return object will be of class data.table if the
package is found in your system.
TileDBFragments$reload_finfo()Refresh the TileDB Fragment Info object.
TileDBFragments$reload_finfo()
The object, invisibly.
TileDBFragments$to_vacuum()Consolidated fragments to be removed.
TileDBFragments$to_vacuum(trunc_uri = TRUE)
trunc_uriTRUE for fragment name in the form: __ts1_ts2_<label>_<ver>,
otherwise FALSE for full path.
An object of class data.frame with four columns:
Fragment: the fragment index (starts at 1)
start_timestamp: fragment's start time stamp
end_timestamp: fragment's end time stamp
URI: fragment's truncated uri path (fragment name) when
trunc_uri = TRUE (default), otherwise the full uri path
Note that the return object will be of class data.table if the
package is found in your system.
TileDBFragments$to_vacuum_num()Return the number of fragments to vacuum
TileDBFragments$to_vacuum_num()
A numeric value.
TileDBFragments$delete_fragment_range()Delete fragments using a time-stamp range.
TileDBFragments$delete_fragment_range(start_time, end_time)
start_time, end_timeTime stamp values. A date time objects
of class POSIXct.
A logical TRUE, invisibly. Note that if time stamps fall
outside fragments' time range no deletion will incur.
TileDBFragments$delete_fragment_list()Delete fragments using a vector of fragment uris.
Use $frag_uris(trunc_uri = FALSE) method to get a data.frame
with all fragment uri paths.
TileDBFragments$delete_fragment_list(frag_uris)
frag_urisA vector of fragment uris.
TRUE for successful deletion, invisibly.
TileDBFragments$delete_fragment()Delete a fragment by index.
TileDBFragments$delete_fragment(n)
nA fragment index to be deleted (starts at 1).
A boolean, invisibly. TRUE for successful deletion and
FALSE for no fragment to delete.
TileDBFragments$get_ifragment()Get a fragment by index.
TileDBFragments$get_ifragment(fid)
fidA fragment index (starts at 1).
An object of class ifragment.
TileDBFragments$get_first_ifragments()Get the first n fragments.
TileDBFragments$get_first_ifragments(n)
nA numeric value.
An object of class ifragment_list.
TileDBFragments$get_last_ifragments()Get the last n fragments.
TileDBFragments$get_last_ifragments(n)
nA numeric value.
An object of class ifragment_list.
TileDBFragments$dump()Dump to console the commit fragments.
TileDBFragments$dump()
TileDBFragments$print()Print Fragments class.
TileDBFragments$print()
TileDBGroup ObjectBase class for representing a TileDB Group.
A new TileDBGroup instance is initialized using the new() method:
# uri path uri <- tempdir() # new instance obj <- TileDBGroup$new(uri = uri) # does array exist at this uri obj$exists() # FALSE unlink(uri)
An object of class TileDBGroup, R6.
TileDBObject -> TileDBGroup
objectAccess the underlying tiledb::tiledb_group() object.
membersAccess the list of group members.
If TileDB group object is closed, it will be opened to get members and close on exit.
TileDBGroup$create()Create a TileDB Group object at the given URI path.
TileDBGroup$create(mode = "WRITE")
modeMode to open : either "READ" or "WRITE" (default).
The object, invisibly.
TileDBGroup$open()Open TileDB group object in read or write mode.
TileDBGroup$open(mode = c("READ", "WRITE"))
modeMode to open : either "READ" or "WRITE". Default is
"READ".
The object, invisibly.
TileDBGroup$close()Close the group object.
All instantiated group members will be closed if opened, and before closing the group object.
TileDBGroup$close()
The object, invisibly.
TileDBGroup$remove()Remove member.
Removes an array or group resource from TileDBGroup member list.
TileDBGroup$remove(name)
nameName of the member to remove.
The object, invisibly.
TileDBGroup$delete()Delete member.
Deletes a TileDBGroup's member from disk and removes it from
member list.
TileDBGroup$delete(name)
nameName of the member to delete.
The object, invisibly.
TileDBGroup$count_members()Count the number of members in the group.
TileDBGroup$count_members()
The number of members in the group.
TileDBGroup$get_members_df()List group members.
TileDBGroup$get_members_df(type = c("ALL", "GROUP", "ARRAY"))
typeSelect type member, either"ALL", "GROUP"
or "ARRAY". By default all member types are listed.
A data.frame with columns name, type, and uri.
TileDBGroup$get_member()Retrieve a group member by name. If the member isn't already open, it is opened in the same mode as the parent.
TileDBGroup$get_member(name)
nameThe name of the member.
A TileDBArray or TileDBGroup.
TileDBGroup$set_member()Add new member to the group.
TileDBGroup$set_member(object, name = NULL, relative = NULL)
objectA TileDBArray or TileDBGroup object to add.
nameName to use for the member. By default the base name of the object's URI is used.
relativeAn optional logical value indicating whether the new
object's URI is relative to the group's URI. If NULL (the
default), the object's URI is assumed to be relative unless it is a
tiledb:// URI.
The object, invisibly.
TileDBGroup$names()Retrieve the members' names.
TileDBGroup$names()
A character vector of member names.
TileDBGroup$member_exists()Check if a member exists.
TileDBGroup$member_exists(name)
nameName of the member to check.
A logical value.
TileDBGroup$print()Print summary of the group.
TileDBGroup$print()
TileDBGroup$dump()Dump the TileDB Group structure to string.
TileDBGroup$dump(title = "TileDB Directory", recursive = TRUE)
titleA character string for title header. Set NULL to
omit.
recursiveShould the nested uris be returned recursively?
Default is TRUE.
A character string, invisibly.
TileDBGroup$clone()The objects of this class are cloneable with this method.
TileDBGroup$clone(deep = FALSE)
deepWhether to make a deep clone.
TileDBGroupExp ObjectAn enhanced version of TileDBGroup with additional methods to operate on the group.
A new TileDBGroupExp instance is initialised using the new() method.
Alternatively use tdb_group() to create a new instance and open the group
at READ mode.
# uri path uri <- tempdir() # new instance obj <- TileDBGroupExp$new(uri = uri) # does group exist at this uri obj$exists() # FALSE unlink(uri)
An object of class TileDBGroupExp, R6.
TileDBObject -> TileDBGroup -> TileDBGroupExp
sizeDirectory size.
TileDBObject$class()TileDBObject$exists()TileDBObject$get_metadata()TileDBObject$initialize()TileDBObject$is_open()TileDBObject$reopen()TileDBObject$set_metadata()TileDBGroup$close()TileDBGroup$count_members()TileDBGroup$create()TileDBGroup$delete()TileDBGroup$dump()TileDBGroup$get_member()TileDBGroup$get_members_df()TileDBGroup$member_exists()TileDBGroup$names()TileDBGroup$open()TileDBGroup$print()TileDBGroup$remove()TileDBGroup$set_member()TileDBGroupExp$has_non_members()Checks for non group members at group's uri path.
This function compares the TileDB resources at group's
uri path to its members to determine if there are any
non member.
TileDBGroupExp$has_non_members()
TRUE for having non members, FALSE otherwise.
TileDBGroupExp$non_members()List TileDB resources which are not
members at group's uri path.
This function compares the TileDB resources at group's
uri path to its members and returns a data.frame with
non members object type and uri path.
TileDBGroupExp$non_members()
An object of class data.frame with columns TYPE
and URI of non member TileDB resources.
TileDBGroupExp$prune_non_members()Delete TileDB resources which are not members.
TileDBGroupExp$prune_non_members()
An character vector of deleted uri paths.
TileDBGroupExp$delete_group()Delete written data from Group.
This function deletes all written data from a tiledb_group object,
i.e., the folder will not be consider as a TileDB Group after the
operation. Any other data will not be deleted unless we set
recursive = TRUE.
TileDBGroupExp$delete_group(recursive = FALSE)
recursiveShould all data be deleted inside the group?
Default is FALSE.
The object, invisibly.
TileDBGroupExp$walk_group()List all TileDB resources at group's uri path.
TileDBGroupExp$walk_group(order = c("pre", "post"))
orderTraversal order, either pre (default) or post.
An object of class data.frame with columns TYPE
and URI with all TileDB resources under group's uri path.
TileDBGroupExp$dir_tree()Print directory contents.
TileDBGroupExp$dir_tree(recursive = TRUE)
recursiveShould it recurse fully? Defaults to TRUE.
A character vector with file paths, invisibly.
TileDBGroupExp$clone()The objects of this class are cloneable with this method.
TileDBGroupExp$clone(deep = FALSE)
deepWhether to make a deep clone.
A modified version of fs::dir_tree() to work with TileDB VFS.
vfs_dir_tree(uri, recursive = TRUE, vfs = NULL)vfs_dir_tree(uri, recursive = TRUE, vfs = NULL)
uri |
URI path for the |
recursive |
Should it recurse fully? Defaults to |
vfs |
A |
A character vector with file paths, invisibly.
## Not run: # URI path uri <- tempfile() # Demo array demo_array_UCBAdmissions(uri) # Array instance arrobj <- tdb_array(uri) # Print directory contents arrobj$dir_tree() ## End(Not run)## Not run: # URI path uri <- tempfile() # Demo array demo_array_UCBAdmissions(uri) # Array instance arrobj <- tdb_array(uri) # Print directory contents arrobj$dir_tree() ## End(Not run)
VFS Directory Size
vfs_size(uri, vfs = NULL)vfs_size(uri, vfs = NULL)
uri |
URI path for the |
vfs |
A |
The size of the directory.
## Not run: # URI path uri <- tempfile() # Demo array demo_UCBAdmissions_array(uri) # Directory size vfs_size(uri) ## End(Not run)## Not run: # URI path uri <- tempfile() # Demo array demo_UCBAdmissions_array(uri) # Directory size vfs_size(uri) ## End(Not run)