Skip to content

Commit 6465ab7

Browse files
committed
going to submit to CRAN
1 parent fc480bb commit 6465ab7

24 files changed

+573
-104
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: assertr
22
Type: Package
33
Title: Assertive Programming for R Analysis Pipelines
4-
Version: 0.9.7
4+
Version: 1.0.0
55
Authors@R: person("Tony", "Fischetti", email="tony.fischetti@gmail.com",
66
role = c("aut", "cre"))
77
Maintainer: Tony Fischetti <tony.fischetti@gmail.com>

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by roxygen2 (4.1.0): do not edit by hand
1+
# Generated by roxygen2 (4.1.1): do not edit by hand
22

33
export(assert)
44
export(assert_)

NEWS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# assertr 1.0.0
2+
3+
* added row reduction functions like mahalanobis distnace
4+
5+
* added assert_rows and insist_rows assert verbs
6+
7+
* bug fixes
8+
19
# assertr 0.5.7
210

311
* added within_n_mads predicate generator

R/assertr.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#' \item \code{\link{insist_rows}}
1717
#' \item \code{\link{not_na}}
1818
#' \item \code{\link{in_set}}
19-
#' \item \code{\link{num_rows_NAs}}
19+
#' \item \code{\link{num_row_NAs}}
2020
#' \item \code{\link{maha_dist}}
2121
#' \item \code{\link{within_bounds}}
2222
#' \item \code{\link{within_n_sds}}
@@ -26,6 +26,7 @@
2626
#'
2727
#' @examples
2828
#' library(magrittr) # for the piping operator
29+
#' library(dplyr)
2930
#'
3031
#' # this confirms that
3132
#' # - that the dataset contains more than 10 observations

R/row-redux.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#' Computes mahalanobis distance for each row of data frame
77
#'
88
#' This function will return a vector, with the same length as the number
9-
#' of rows of the provided data frame, corresponding to the mahalanobis
10-
#' distances of each row.
9+
#' of rows of the provided data frame, corresponding to the average
10+
#' mahalanobis distances of each row from the whole data set.
1111
#'
12-
#' This is useful for finding anomalous row-wise observations.
12+
#' This is useful for finding anomalous observations, row-wise.
1313
#'
14-
#' It will convert strings into numerics.
14+
#' It will convert any categorical variables in the data frame into numerics.
1515
#'
1616
#' @param data A data frame
1717
#' @param keep.NA Ensure that every row with missing data remains NA in

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The assertr package supplies a suite of functions designed to verify
1212
assumptions about data early in an analysis pipeline so that
1313
data 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
1616
mechanism 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
3232
shortly 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
3535
built-in but rather procured from an external source that was known for making
3636
errors in data entry or coding. Pretend we wanted to find the average
3737
miles 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
4444
respectively) 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

5050
This 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
103103
function 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
106107
function, and an arbitrary number of columns to apply the predicate function
107108
to. The row reduction function is applied to the data frame, and returns a value
108109
for 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

141142
Finally, each assertion function has a counterpart that using standard
142143
evaluation. The counterpart functions are postfixed by "_" (an underscore).

cran-comments.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
## Test environments
2-
* local OS X Yosemite 10.10.2 install, R 3.1.3
3-
* ubuntu (on travis-ci), R 3.1.2
2+
* local OS X Yosemite 10.10.2 install, R 3.2.1
3+
* ubuntu (on travis-ci), R 3.2.1
44
* win-builder (devel and release)
55

66
## R CMD check results
77

8-
There were no ERRORs, WARNINGs or NOTEs
9-
when checked locally with --no-manual
8+
There were no ERRORs, WARNINGs but 1 NOTE
9+
when checked locally with --as-cran and --no-manual
1010

11-
I got an email from Uwe.Ligges@R-project.org saying that assertr v0.4
12-
(which was just accepted into CRAN a few days ago) failed with the
13-
oldrelease (3.0.3). I was told to either fix or declare a proper version
14-
dependency.
11+
The NOTE said:
12+
* checking CRAN incoming feasibility ... NOTE
13+
Maintainer: 'Tony Fischetti <tony.fischetti@gmail.com>'
1514

16-
I fixed it, slightly incremented the version number and I am submitting it
17-
here. This is the proper thing to do, right? Please excuse my ignorance, as
18-
this is my first package.
15+
License components with restrictions and base license permitting such:
16+
MIT + file LICENSE
17+
File 'LICENSE':
18+
YEAR: 2015
19+
COPYRIGHT HOLDER: Tony Fischetti

inst/doc/assertr.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ not.empty.p <- function(x) if(x=="") return(FALSE)
2020
## ------------------------------------------------------------------------
2121
seven.digit.p <- function(x) nchar(x)==7
2222

23+
## ----perl=FALSE----------------------------------------------------------
24+
example.data <- data.frame(x=c(8, 9, 6, 5, 9, 5, 6, 7,
25+
8, 9, 6, 5, 5, 6, 7),
26+
y=c(82, 91, 61, 49, 40, 49, 57,
27+
74, 78, 90, 61, 49, 51, 62, 68))
28+
(example.data)
29+

0 commit comments

Comments
 (0)