rsummary: Compute usable summary of columns of remote table.

View source: R/rsummary.R

rsummaryR Documentation

Compute usable summary of columns of remote table.

Description

Compute per-column summaries and return as a data.frame. Warning: can be an expensive operation.

Usage

rsummary(
  db,
  tableName,
  ...,
  countUniqueNum = FALSE,
  quartiles = FALSE,
  cols = NULL,
  qualifiers = NULL
)

Arguments

db

database connection.

tableName

name of table.

...

force additional arguments to be bound by name.

countUniqueNum

logical, if TRUE include unique non-NA counts for numeric cols.

quartiles

logical, if TRUE add Q1 (25%), median (50%), Q3 (75%) quartiles.

cols

if not NULL set of columns to restrict to.

qualifiers

optional named ordered vector of strings carrying additional db hierarchy terms, such as schema.

Details

For numeric columns includes NaN in nna count (as is typical for R, e.g., is.na(NaN)).

Value

data.frame summary of columns.

Examples


if (requireNamespace("DBI", quietly = TRUE) &&
  requireNamespace("RSQLite", quietly = TRUE)) {
  d <- data.frame(p= c(TRUE, FALSE, NA),
                  s= NA,
                  w= 1:3,
                  x= c(NA,2,3),
                  y= factor(c(3,5,NA)),
                  z= c('a',NA,'a'),
                  stringsAsFactors=FALSE)
  db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
  RSQLite::initExtension(db)
  rq_copy_to(db, "dRemote", d,
              overwrite = TRUE, temporary = TRUE)
  print(rsummary(db, "dRemote"))
  DBI::dbDisconnect(db)
}


rquery documentation built on Aug. 20, 2023, 9:06 a.m.