assertive.properties v0.0-4

0

Monthly downloads

0th

Percentile

Assertions to Check Properties of Variables

A set of predicates and assertions for checking the properties of variables, such as length, names and attributes. This is mainly for use by other package developers who want to include run-time testing features in their own packages. End-users will usually want to use assertive directly.

Readme

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Is the package on CRAN? SemaphoreCI Build Status AppVeyor Build Status

assertive.properties

A set of predicates and assertions for checking the properties of variables, such as length, names and attributes. Most of the documentation is on the assertive page. End-users will usually want to use assertive directly.

Installation

To install the stable version, type:

install.packages("assertive.properties")

To install the development version, you first need the devtools package.

install.packages("devtools")

Then you can install the assertive.properties package using

library(devtools)
install_bitbucket("richierocks/assertive.properties")

Predicates

has_attributes checks a variable for the presence of named attributes. has_any_attributes and has_no_attributes check for the presence or absence of any attributes at all.

has_dims, has_rows, and has_cols check for the dimensions, rows and columns respectively.

has_duplicates and has_no_duplicates check whether or not a vector has duplicate elements.

has_names, has_dimnames, has_rownames, and has_colnames check for various types of name.

is_atomic, is_recursive, and is_vector check for these types of variables.

is_empty, is_non_empty, is_scalar, and is_non_scalar check for objects of length 0 or 1 (or objects with 0/1 element).

is_of_length, has_elements, and is_of_dimension provide more general variable size checks.

are_same_length and have_same_dims check for two variables having the same length/dimensions.

is_null and is_not_null check whether an object is NULL or not.

is_unsorted checks for unsorted vectors.

Assertions

Predicates that return a vector have two corresponding assertions. For example, has_attributes has assert_has_all_attributes and assert_has_any_attributes.

Predicates returning a single logical value have one corresponding assertion. For example, is_null has assert_is_null.

Utilities

DIM returns the dimension of an object, and works with vectors (like NROW and NCOL).

n_elements returns the number of elements in an object.

Functions in assertive.properties

Name Description
assert_is_atomic Is the input atomic/recursive/vector?
assert_has_duplicates Does the input have duplicates?
assert_is_not_null Is the input (not) null?
assert_has_all_attributes Does the input have the specified attributes?
has_any_attributes Does the input have any attributes?
assert_has_colnames Does the input have names?
assert_is_unsorted Is the input unsorted?
n_elements Get the number of elements
assert_is_monotonic_increasing Is the vector monotonically increasing or decreasing?
assert_has_elements Is the input empty/scalar?
are_same_length Are the inputs the same length/dimension?
assert_has_cols Does the input have rows/columns?
DIM Get the dimensions of an object
assert_has_slot Does the S4 input have a slot?
assert_has_dims Does the input have dimensions?
No Results!

Last month downloads

Details

Type Package
Date 2016-12-29
URL https://bitbucket.org/richierocks/assertive.properties
BugReports https://bitbucket.org/richierocks/assertive.properties/issues
License GPL (>= 3)
LazyLoad yes
LazyData yes
Acknowledgments Development of this package was partially funded by the Proteomics Core at Weill Cornell Medical College in Qatar . The Core is supported by 'Biomedical Research Program' funds, a program funded by Qatar Foundation.
RoxygenNote 5.0.1
Collate 'are-same-size.R' 'assert-are-same-size.R' 'imports.R' 'assert-has-attributes.R' 'assert-has-dims.R' 'assert-has-dupes.R' 'assert-has-names.R' 'assert-has-slot.R' 'assert-is-atomic-recursive-vector.R' 'assert-is-empty-scalar.R' 'assert-is-monotonic.R' 'assert-is-null.R' 'assert-is-unsorted.R' 'has-attributes.R' 'has-dims.R' 'has-dupes.R' 'has-names.R' 'has-slot.R' 'is-atomic-recursive-vector.R' 'is-empty-scalar.R' 'is-monotonic.R' 'is-null.R' 'is-unsorted.R' 'utils.R'
NeedsCompilation no
Packaged 2016-12-30 02:19:21 UTC; richierocks
Repository CRAN
Date/Publication 2016-12-30 10:12:22

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/assertive.properties)](http://www.rdocumentation.org/packages/assertive.properties)