Skip to content

Commit

Permalink
fixing issue with is.atomic(NULL)
Browse files Browse the repository at this point in the history
  • Loading branch information
edwindj committed Sep 30, 2023
1 parent 1a2d23e commit 7d76ccf
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion R/categorical.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ is_cat_ <- function(expr, or=TRUE, ...){
return(TRUE)
}

if(is.atomic(expr)){
if(is.atomic(expr) || is.null(expr)){
return(is.logical(expr))
}

Expand Down
2 changes: 1 addition & 1 deletion R/conditional.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ rep_lin_ <- function(e, or=TRUE, h=new.env()){
l <- left(e)
r <- right(e)

if (is.atomic(e) || is.symbol(e)){
if (is.atomic(e) || is.symbol(e) || is.null(e)){
return(e)
}

Expand Down
6 changes: 5 additions & 1 deletion R/linear.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ is_lin_ <- function(expr, top=TRUE, ...){
return(is_lin_(l, FALSE) && is_lin_(r, FALSE))
}

if (is.null(expr)){
return(TRUE)
}

if (is.atomic(expr)){
return(is.numeric(expr) || is.null(expr))
return(is.numeric(expr))
}

if (is.symbol(expr)){ return(TRUE) }
Expand Down
3 changes: 2 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ library(validatetools)
<!-- badges: start -->
[![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)
[![CRAN status](https://www.r-pkg.org/badges/version/validatetools)](https://CRAN.R-project.org/package=validatetools)
[![Mentioned in Awesome Official Statistics ](https://awesome.re/mentioned-badge.svg)](http://www.awesomeofficialstatistics.org)
[![codecov](https://codecov.io/github/data-cleaning/validatetools/graph/badge.svg?token=3tIe5HAUWm)](https://codecov.io/github/data-cleaning/validatetools)
[![Mentioned in Awesome Official Statistics](https://awesome.re/mentioned-badge.svg)](http://www.awesomeofficialstatistics.org)
<!-- badges: end -->

# validatetools
Expand Down
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@

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

[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/validatetools)](https://cran.r-project.org/package=validatetools)
[![Travis-CI Build
Status](https://travis-ci.org/data-cleaning/validatetools.svg?branch=master)](https://travis-ci.org/data-cleaning/validatetools)
[![AppVeyor Build
Status](https://ci.appveyor.com/api/projects/status/github/data-cleaning/validatetools?branch=master&svg=true)](https://ci.appveyor.com/project/edwindj/validatetools)
[![Coverage
Status](https://img.shields.io/codecov/c/github/data-cleaning/validatetools/master.svg)](https://codecov.io/github/data-cleaning/validatetools?branch=master)
[![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)
[![CRAN
status](https://www.r-pkg.org/badges/version/validatetools)](https://CRAN.R-project.org/package=validatetools)
[![codecov](https://codecov.io/github/data-cleaning/validatetools/graph/badge.svg?token=3tIe5HAUWm)](https://codecov.io/github/data-cleaning/validatetools)
[![Mentioned in Awesome Official
Statistics](https://awesome.re/mentioned-badge.svg)](http://www.awesomeofficialstatistics.org)
<!-- badges: end -->

# validatetools

Expand All @@ -28,8 +27,7 @@ issues.
install.packages("validatetools")
```

The latest beta version of `validatetools` can be installed
with
The latest beta version of `validatetools` can be installed with

``` r
install.packages("validatetools", repos = "https://data-cleaning.github.io/drat")
Expand Down Expand Up @@ -156,7 +154,7 @@ rules <- validator( if (age < 16) income == 0
)
simplify_conditional(rules)
#> Object of class 'validator' with 2 elements:
#> V1: !(age < 16) | (income == 0)
#> V1: age >= 16 | (income == 0)
#> V2: income >= 0
```

Expand Down

0 comments on commit 7d76ccf

Please sign in to comment.