replyr_summary
example.
replyr_summary
works on various data sources, counts NA
, and returns a data.frame
(instead of text).
d <- data.frame(x=c(NA,'b'), y=c(1,NA), stringsAsFactors= FALSE) summary(d) # x y # Length:2 Min. :1 # Class :character 1st Qu.:1 # Mode :character Median :1 # Mean :1 # 3rd Qu.:1 # Max. :1 # NA's :1 replyr::replyr_summary(d) # Warning: replacing previous import 'vctrs::data_frame' by 'tibble::data_frame' when loading 'dplyr' # column index class nrows nna nunique min max mean sd lexmin lexmax # 1 x 1 character 2 1 NA NA NA NA NA b b # 2 y 2 numeric 2 1 NA 1 1 1 NA <NA> <NA> execute_vignette <- requireNamespace("RSQLite", quietly = TRUE) if(execute_vignette) { my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:") RSQLite::initExtension(my_db) dbData <- dplyr::copy_to(my_db, d) summary(dbData) replyr::replyr_summary(dbData) # glimpse works more like str or head dplyr::glimpse(dbData) } # Rows: ?? # Columns: 2 # Database: sqlite 3.30.1 [:memory:] # $ x <chr> NA, "b" # $ y <dbl> 1, NA
DBI::dbDisconnect(my_db) rm(list=ls()) gc() # used (Mb) gc trigger (Mb) limit (Mb) max used (Mb) # Ncells 1023256 54.7 2089101 111.6 NA 1327360 70.9 # Vcells 1850902 14.2 8388608 64.0 16384 2730196 20.9