Skip to content

cgiachalis/R6.tiledb

Repository files navigation

R6.tiledb

repo-status CRAN status coverage

An extension to TileDB-R interface.

TileDB Embedded is a high performant storage engine for dense and sparse multi-dimensional arrays. R6.tiledb is built on top of R6 object-oriented system and extends tiledb R package with base classes, which represent TileDB Arrays and Groups, as well as with subclasses that encapsulate additional methods. It provides also functional wrappers, convenient utilities and S3 methods.

The package can be helpful to create domain specific applications and unified data architectures by extending the base classes, or using its functional interface to work with existing TileDB resources.

Usage

To use R6.tiledb, first create a TileDB resource:

 library(R6.tiledb)

 # URI path
 uri <- tempfile()
  
 # Demo array from 'UCBAdmissions' built-in dataset
 demo_UCBAdmissions_array(uri)
  
 # Create an instance that represents the array
 arrobj <- tdb_array(uri)
  
 arrobj
 #> R6Class: <TileDBArrayExp>
 #> → URI Basename: file3ea47b75133b
 #>   • Dimensions: "Dept" and "Gender"
 #>   • Attributes: "Admit" and "Freq"

Using class methods :

 # Query the number of fragments 
 arrobj$frag_num()
 #> [1] 3

 # Does the array have factors (enums)
 arrobj$any_enums()
 #>[1] TRUE

 # Run query on 'Dept' dimension
 arr <- arrobj$tiledb_array(selected_points = list(Dept = "A"),
                            return_as = "data.frame")
                            
 # Materialise array as 'data.frame'                   
 arr[]
 #>   Dept Gender    Admit Freq
 #> 1    A Female Admitted   89
 #> 2    A Female Rejected   19
 #> 3    A   Male Rejected  313
 #> 4    A   Male Admitted  512

See Getting Started documentation for more examples.

Installation

Development version from GitHub:

# pak
pak::pkg_install("cgiachalis/R6.tiledb")

# remotes
remotes::install_github("cgiachalis/R6.tiledb")

Acknowledgements

TileDB SOMA-R project for extracting the R6 base classes from: TileDBArray and TileDBGroup which this repo has modified extensively that can not be considered drop-in replacements1.

Resources

  • Introduction to Arrays [TileDB Academy]

  • Dirk Eddelbuettel and Aaron Wolen (2021), Using TileDB with R: An Introductory Tutorial [slides]

  • Aaron Wolen and Dirk Eddelbuettel (2021), Infinitely Scalable Data Analysis: Using R with TileDB Tutorial [slides]

  • A deep dive into the TileDB data format & storage engine [video]

Disclaimer

Please note that this project is not an official TileDB-Inc product.

Footnotes

  1. R6 class names: TileDBArray and TileDBGroup are no longer used by SOMA-R

About

R6 Classes for TileDB Arrays and Groups

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published