generate.assertions: Generate Assertions

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/PCSmisc.R

Description

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

Usage

1
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)

Ben Rich <[email protected]>

See Also

stopifnot

Examples

1
2
3
4
5
6
7
8
## Not run: 
require(nlme)
data(Phenobarb)
sink("Phenobarb_checks.R")
generate.assertions(Phenobarb)
sink()

## End(Not run)

benjaminrich/PCSmisc documentation built on Dec. 17, 2017, 12:50 a.m.