generate.assertions | R Documentation |
Use this function to generate simple code asserstions about a
data.frame
.
generate.assertions(dat, max.level.show = 12, digits.compare = 6)
dat |
A |
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? |
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 factor
s, 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.
None (invisible
'NULL
').
Benjamin Rich <mail@benjaminrich.net>
stopifnot
## Not run:
require(nlme)
data(Phenobarb)
sink("Phenobarb_checks.R")
generate.assertions(Phenobarb)
sink()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.