getNullCounts: Counts nulls per column in the table.

Description Usage Arguments Examples

View source: R/utils.R

Description

Counts nulls per column in the table.

Usage

1
2
3
getNullCounts(channel, tableName, tableInfo = NULL, include = NULL,
  except = NULL, output = "long", percent = FALSE, schema = NULL,
  where = NULL, stringsAsFactors = FALSE, test = FALSE)

Arguments

channel

object as returned by odbcConnect.

tableName

name of the table in Aster.

tableInfo

pre-built summary of columns to use (require when test=TRUE). See sqlColumns or getTableSummary.

include

a vector of column names to include. Output never contains attributes other than in the list.

except

a vector of column names to exclude. Output never contains attributes from the list.

output

Default output is a data frame in 'long' format. Other options include 'wide' format and 'matrix'.

percent

logical: if TRUE then percent of NULL values instead of absolute count returned. To avoid division by zero small error is introduced by incrementing by 1 total count of rows in the table.

schema

NULL or character: optional schema to restric table search to signle schema. In general, table search performed across whole database. Including schema restricts it to this single schema only.

where

specifies criteria to satisfy by the table rows before applying computation. The creteria are expressed in the form of SQL predicates (inside WHERE clause).

stringsAsFactors

logical: should data frame returned have column with variables (table column names) as factor? Applies only when the output is in long format.

test

logical: if TRUE show what would be done, only (similar to parameter test in RODBC functions like sqlQuery and sqlSave).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
if (interactive()) {
# initialize connection to Dallas database in Aster 
conn = odbcDriverConnect(connection="driver={Aster ODBC Driver};
                         server=<dbhost>;port=2406;database=<dbname>;uid=<user>;pwd=<pw>")

null_counts = getNullCounts(conn, "baseball.batting", 
                            include=c('g','ab','r','h','so','bb','cs'), 
                            where='yearid > 2000')

}

toaster documentation built on May 30, 2017, 3:51 a.m.