Learn R Programming

motherduck (version 0.2.0)

summary: Summarize a Lazy DBI Table

Description

The summary.tbl_lazy() method provides a database-aware summary interface for lazy tables created via dbplyr. Instead of collecting data into R, it constructs a SQL SUMMARIZE query and executes it remotely, returning another lazy table reference.

Usage

# S3 method for tbl_lazy
summary(object, ...)

Value

A tbl_lazy object containing the summarized results, still backed by the remote database connection.

Arguments

object

A tbl_lazy object representing a remote database table or query.

...

Additional arguments (currently unused). Present for S3 method compatibility.

Details

This method does not pull data into memory. Instead, it creates a new lazy query object representing the database-side summary. To retrieve the summarized data, use collect() on the returned object.

Examples

Run this code
if (FALSE) {
library(DBI)
library(duckdb)
library(dplyr)

con <- dbConnect(duckdb::duckdb(dbdir = tempfile()))
dbWriteTable(con, "mtcars", mtcars)

tbl_obj <- tbl(con, "mtcars")

# Returns a lazy summary table
summary(tbl_obj)

dbDisconnect(con)
}


Run the code above in your browser using DataLab