This package is based on GlareDB v0.9.5.
Check out the GlareDB repo for details.
Installation
This package can be installed from R-multiverse. 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 = "https://community.r-multiverse.org")
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 │
#> └─────┴────────┴─────┴────────┘