generate.assertions: Generate Assertions

View source: R/PCSmisc.R

generate.assertionsR Documentation

Generate Assertions

Description

Use this function to generate simple code asserstions about a data.frame.

Usage

generate.assertions(dat, max.level.show = 12, digits.compare = 6)

Arguments

dat

A data.frame.

max.level.show

Maximum number of factor levels for which to generate an assertion.

digits.compare

How many decimal digits to include in comparisons of numeric data?

Details

Assertions are generated about the number of rows and columns in the data.frame, and about each column it contains. An assertion is generated about the class of the column, and the number of missing values (NA). If the column has a label attribute, then as assertion is generated for that as well. Further assertions depend on the class of the column. For factors, the number of levels is asserted. If this does not exceed max.level.show then the levels are asserted as well. For numeric data, the range (rounded to digits.compare is asserted.

Value

None (invisible 'NULL').

Author(s)

Benjamin Rich <mail@benjaminrich.net>

See Also

stopifnot

Examples

## Not run: 
require(nlme)
data(Phenobarb)
sink("Phenobarb_checks.R")
generate.assertions(Phenobarb)
sink()

## End(Not run)

benjaminrich/PCSmisc documentation built on Feb. 11, 2024, 9:25 p.m.