@@ -12,7 +12,7 @@ The assertr package supplies a suite of functions designed to verify
1212assumptions about data early in an analysis pipeline so that
1313data errors are spotted early and can be addressed quickly.
1414
15- This package in no way needs to be used with the magrittr/dplyr piping
15+ This package does not need to be used with the magrittr/dplyr piping
1616mechanism but the examples in this README use them for clarity.
1717
1818### Installation
@@ -31,7 +31,7 @@ This package offers five assertion functions, `assert`, `verify`,
3131` insist ` , ` assert_rows ` , and ` insist_rows ` , that are designed to be used
3232shortly after data-loading in an analysis pipeline...
3333
34- Let’s say, for example, that the R’s built-in car dataset, mtcars, was not
34+ Let’s say, for example, that the R’s built-in car dataset, ` mtcars ` , was not
3535built-in but rather procured from an external source that was known for making
3636errors in data entry or coding. Pretend we wanted to find the average
3737miles per gallon for each number of engine cylinders. We might want to first,
@@ -44,7 +44,7 @@ that is outside 4 standard deviations from its mean, and
4444respectively) contain 0s and 1s only
4545- each row contains at most 2 NAs
4646- each row's mahalanobis distance is within 10 median absolute deviations of
47- all the distance (for outlier detection)
47+ all the distances (for outlier detection)
4848
4949
5050This could be written (in order) using ` assertr ` like this:
@@ -102,7 +102,8 @@ missing values in each row. Internally, the `assert_rows` function uses
102102` dplyr ` 's` select ` function to extract the columns to test the predicate
103103function on.
104104
105- - ` insist_rows ` - takes a data frame, a row reduction function, a predicate
105+ - ` insist_rows ` - takes a data frame, a row reduction function, a
106+ predicate-generating
106107function, and an arbitrary number of columns to apply the predicate function
107108to. The row reduction function is applied to the data frame, and returns a value
108109for each row. The predicate-generating function is then applied to the vector
@@ -136,7 +137,7 @@ and `insist_rows`:
136137
137138- ` num_row_NAs ` - counts number of missing values in each row
138139- ` maha_dist ` - computes the mahalanobis distance of each row (for outlier
139- detection)
140+ detection). It will coerce categorical variables into numerics if it needs to.
140141
141142Finally, each assertion function has a counterpart that using standard
142143evaluation. The counterpart functions are postfixed by "_ " (an underscore).
0 commit comments