Skip to content

Commit 7d76ccf

Browse files
committed
fixing issue with is.atomic(NULL)
1 parent 1a2d23e commit 7d76ccf

5 files changed

Lines changed: 17 additions & 14 deletions

File tree

R/categorical.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ is_cat_ <- function(expr, or=TRUE, ...){
88
return(TRUE)
99
}
1010

11-
if(is.atomic(expr)){
11+
if(is.atomic(expr) || is.null(expr)){
1212
return(is.logical(expr))
1313
}
1414

R/conditional.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ rep_lin_ <- function(e, or=TRUE, h=new.env()){
7878
l <- left(e)
7979
r <- right(e)
8080

81-
if (is.atomic(e) || is.symbol(e)){
81+
if (is.atomic(e) || is.symbol(e) || is.null(e)){
8282
return(e)
8383
}
8484

R/linear.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ is_lin_ <- function(expr, top=TRUE, ...){
3434
return(is_lin_(l, FALSE) && is_lin_(r, FALSE))
3535
}
3636

37+
if (is.null(expr)){
38+
return(TRUE)
39+
}
40+
3741
if (is.atomic(expr)){
38-
return(is.numeric(expr) || is.null(expr))
42+
return(is.numeric(expr))
3943
}
4044

4145
if (is.symbol(expr)){ return(TRUE) }

README.Rmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ library(validatetools)
1616
<!-- badges: start -->
1717
[![R-CMD-check](https://github.com/data-cleaning/validatetools/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/data-cleaning/validatetools/actions/workflows/R-CMD-check.yaml)
1818
[![CRAN status](https://www.r-pkg.org/badges/version/validatetools)](https://CRAN.R-project.org/package=validatetools)
19-
[![Mentioned in Awesome Official Statistics ](https://awesome.re/mentioned-badge.svg)](http://www.awesomeofficialstatistics.org)
19+
[![codecov](https://codecov.io/github/data-cleaning/validatetools/graph/badge.svg?token=3tIe5HAUWm)](https://codecov.io/github/data-cleaning/validatetools)
20+
[![Mentioned in Awesome Official Statistics](https://awesome.re/mentioned-badge.svg)](http://www.awesomeofficialstatistics.org)
2021
<!-- badges: end -->
2122

2223
# validatetools

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11

22
<!-- README.md is generated from README.Rmd. Please edit that file -->
3+
<!-- badges: start -->
34

4-
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/validatetools)](https://cran.r-project.org/package=validatetools)
5-
[![Travis-CI Build
6-
Status](https://travis-ci.org/data-cleaning/validatetools.svg?branch=master)](https://travis-ci.org/data-cleaning/validatetools)
7-
[![AppVeyor Build
8-
Status](https://ci.appveyor.com/api/projects/status/github/data-cleaning/validatetools?branch=master&svg=true)](https://ci.appveyor.com/project/edwindj/validatetools)
9-
[![Coverage
10-
Status](https://img.shields.io/codecov/c/github/data-cleaning/validatetools/master.svg)](https://codecov.io/github/data-cleaning/validatetools?branch=master)
5+
[![R-CMD-check](https://github.com/data-cleaning/validatetools/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/data-cleaning/validatetools/actions/workflows/R-CMD-check.yaml)
6+
[![CRAN
7+
status](https://www.r-pkg.org/badges/version/validatetools)](https://CRAN.R-project.org/package=validatetools)
8+
[![codecov](https://codecov.io/github/data-cleaning/validatetools/graph/badge.svg?token=3tIe5HAUWm)](https://codecov.io/github/data-cleaning/validatetools)
119
[![Mentioned in Awesome Official
1210
Statistics](https://awesome.re/mentioned-badge.svg)](http://www.awesomeofficialstatistics.org)
11+
<!-- badges: end -->
1312

1413
# validatetools
1514

@@ -28,8 +27,7 @@ issues.
2827
install.packages("validatetools")
2928
```
3029

31-
The latest beta version of `validatetools` can be installed
32-
with
30+
The latest beta version of `validatetools` can be installed with
3331

3432
``` r
3533
install.packages("validatetools", repos = "https://data-cleaning.github.io/drat")
@@ -156,7 +154,7 @@ rules <- validator( if (age < 16) income == 0
156154
)
157155
simplify_conditional(rules)
158156
#> Object of class 'validator' with 2 elements:
159-
#> V1: !(age < 16) | (income == 0)
157+
#> V1: age >= 16 | (income == 0)
160158
#> V2: income >= 0
161159
```
162160

0 commit comments

Comments
 (0)