/r-glaredb

R bindings for GlareDB

Primary LanguageRGNU Affero General Public License v3.0AGPL-3.0

R bindings for GlareDB

glaredb status badge CRAN status

Check out the GlareDB repo to learn more.

Installation

This package can be installed from R-universe. If available, a binary package will be installed.

Currently, Windows is not supported. Please use WSL2.

Sys.setenv(NOT_CRAN = "true")
install.packages("glaredb", repos = c("https://eitsupi.r-universe.dev", options("repos")))

Examples

Use GlareDB directly in R to query and analyzer a variety of data sources, including arrow::Table and polars::RPolarsDataFrame.

library(glaredb)
library(polars)

df <- pl$DataFrame(
  A = 1:5,
  fruits = c("banana", "banana", "apple", "apple", "banana"),
  B = 5:1,
  C = c("beetle", "audi", "beetle", "beetle", "beetle")
)

df2 <- glaredb_sql("select * from df where fruits = 'banana'") |>
  as_polars_df()

df2
#> shape: (3, 4)
#> ┌─────┬────────┬─────┬────────┐
#> │ A   ┆ fruits ┆ B   ┆ C      │
#> │ --- ┆ ---    ┆ --- ┆ ---    │
#> │ i32 ┆ str    ┆ i32 ┆ str    │
#> ╞═════╪════════╪═════╪════════╡
#> │ 1   ┆ banana ┆ 5   ┆ beetle │
#> │ 2   ┆ banana ┆ 4   ┆ audi   │
#> │ 5   ┆ banana ┆ 1   ┆ beetle │
#> └─────┴────────┴─────┴────────┘