Skip to content

Commit 5f5d7ed

Browse files
committed
updating docs, making it CRAN ready
1 parent 473d92c commit 5f5d7ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+147
-5126
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
87

9-
name: R-CMD-check
8+
name: R-CMD-check.yaml
9+
10+
permissions: read-all
1011

1112
jobs:
1213
R-CMD-check:
@@ -29,7 +30,7 @@ jobs:
2930
R_KEEP_PKG_SOURCE: yes
3031

3132
steps:
32-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3334

3435
- uses: r-lib/actions/setup-pandoc@v2
3536

@@ -47,3 +48,4 @@ jobs:
4748
- uses: r-lib/actions/check-r-package@v2
4849
with:
4950
upload-snapshots: true
51+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

.github/workflows/test-coverage.yaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
87

9-
name: test-coverage
8+
name: test-coverage.yaml
9+
10+
permissions: read-all
1011

1112
jobs:
1213
test-coverage:
@@ -15,36 +16,47 @@ jobs:
1516
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1617

1718
steps:
18-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
1920

2021
- uses: r-lib/actions/setup-r@v2
2122
with:
2223
use-public-rspm: true
2324

2425
- uses: r-lib/actions/setup-r-dependencies@v2
2526
with:
26-
extra-packages: any::covr
27+
extra-packages: any::covr, any::xml2
2728
needs: coverage
2829

2930
- name: Test coverage
3031
run: |
31-
covr::codecov(
32+
cov <- covr::package_coverage(
3233
quiet = FALSE,
3334
clean = FALSE,
34-
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
35+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3536
)
37+
print(cov)
38+
covr::to_cobertura(cov)
3639
shell: Rscript {0}
3740

41+
- uses: codecov/codecov-action@v5
42+
with:
43+
# Fail if error if not on PR, or if on PR and token is given
44+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
45+
files: ./cobertura.xml
46+
plugins: noop
47+
disable_search: true
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
3850
- name: Show testthat output
3951
if: always()
4052
run: |
4153
## --------------------------------------------------------------------
42-
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
54+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
4355
shell: bash
4456

4557
- name: Upload test results
4658
if: failure()
47-
uses: actions/upload-artifact@v3
59+
uses: actions/upload-artifact@v4
4860
with:
4961
name: coverage-test-failures
5062
path: ${{ runner.temp }}/package

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Authors@R: c( person("Edwin", "de Jonge", email = "[email protected]", role
99
Description: Rule sets with validation rules may contain redundancies or contradictions.
1010
Functions for finding redundancies and problematic rules are provided,
1111
given a set a rules formulated with 'validate'.
12-
Depends: validate
12+
Depends: validate, R (>= 4.1.0)
1313
License: MIT + file LICENSE
1414
Encoding: UTF-8
1515
URL: https://github.com/data-cleaning/validatetools
@@ -18,3 +18,4 @@ Imports: methods, stats, utils, lpSolveAPI
1818
Suggests: testthat,
1919
covr
2020
RoxygenNote: 7.3.2
21+
Roxygen: list(markdown = TRUE)

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# validatetools 0.6.0
22

3-
* added a fix when categorical variables where used, without a rule that specified the domain. Thanks to
3+
* added a fix when categorical variables where used, without a rule that specified the domain. (issue #15) Thanks to
44
Romina Filippini and Simona Toti for reporting.
55

66
# validatetools 0.5.2

R/contradicted.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#' of the rules should stay and which should go?
55
#' @export
66
#' @example ./examples/feasible.R
7-
#' @param x \code{\link{validator}} object with rules.
8-
#' @param rule_name \code{character} with the names of the rules that are causing infeasibility.
7+
#' @param x [validate::validator()] object with rules.
8+
#' @param rule_name `character` with the names of the rules that are causing infeasibility.
99
#' @family feasibility
10-
#' @return \code{character} with conflicting rules.
10+
#' @return `character` with conflicting rules.
1111
is_contradicted_by <- function(x, rule_name){
1212
rn <- rule_name %in% names(x)
1313

R/detect_boundary.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#' Detect the range for numerical variables
22
#'
33
#' Detect for each numerical variable in a validation rule set, what its maximum and minimum values are.
4-
#' This allows for manual rule set checking: does rule set \code{x} overly constrain numerical values?
4+
#' This allows for manual rule set checking: does rule set `x` overly constrain numerical values?
55
#'
66
#' This procedure only finds minimum and maximum values, but misses gaps.
77
#'
8-
#' @seealso \code{\link{detect_fixed_variables}}
8+
#' @seealso [detect_fixed_variables()]
99
#' @references Statistical Data Cleaning with R (2017), Chapter 8, M. van der Loo, E. de Jonge
1010
#' @references Simplifying constraints in data editing (2015). Technical Report 2015|18, Statistics Netherlands, J. Daalmans
1111
#' @example ./examples/detect_boundary.R
1212
#' @export
13-
#' @param x \code{\link{validator}} object, rule set to be checked
13+
#' @param x [validate::validator()] object, rule set to be checked
1414
#' @param eps detected fixed values will have this precision.
1515
#' @param ... currently not used
1616
#' @family feasibility
17-
#' @return \code{\link{data.frame}} with columns "variable", "lowerbound", "upperbound".
17+
#' @return [data.frame()] with columns "variable", "lowerbound", "upperbound".
1818
detect_boundary_num <- function(x, eps = 1e-8, ...){
1919
x <- check_validator(x)
2020
prec <- -log(eps, 10)
@@ -62,11 +62,11 @@ detect_boundary_num <- function(x, eps = 1e-8, ...){
6262
#'
6363
#' Detect viable domains for categorical variables
6464
#' @example ./examples/detect_boundary.R
65-
#' @param x \code{\link{validator}} object with rules
65+
#' @param x [validate::validator()] object with rules
6666
#' @param as_df return result as data.frame (before 0.4.5)
6767
#' @param ... not used
6868
#' @family feasibility
69-
#' @return \code{data.frame} with columns \code{$variable}, \code{$value}, \code{$min}, \code{$max}. Each row is a
69+
#' @return `data.frame` with columns `$variable`, `$value`, `$min`, `$max`. Each row is a
7070
#' category/value of a categorical variable.
7171
#' @export
7272
detect_boundary_cat <- function(x, ..., as_df = FALSE){

R/detect_fixed_variables.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#' Detects variables that have a fixed value in the rule set.
44
#' To simplify a rule set, these variables can be substituted with their value.
55
#' @example ./examples/detect_fixed_variables.R
6-
#' @seealso \code{\link{simplify_fixed_variables}}
7-
#' @param x \code{\link{validator}} object with the validation rules.
6+
#' @seealso [simplify_fixed_variables()]
7+
#' @param x [validate::validator()] object with the validation rules.
88
#' @param eps detected fixed values will have this precission.
99
#' @param ... not used.
1010
#' @family redundancy
@@ -38,11 +38,11 @@ detect_fixed_variables <- function(x, eps = x$options("lin.eq.eps"), ...){
3838
#'
3939
#' @export
4040
#' @example ./examples/detect_fixed_variables.R
41-
#' @param x \code{\link{validator}} object with validation rules
41+
#' @param x [validate::validator()] object with validation rules
4242
#' @param eps detected fixed values will have this precission.
43-
#' @param ... passed to \code{\link{substitute_values}}.
43+
#' @param ... passed to [substitute_values()].
4444
#' @family redundancy
45-
#' @return \code{\link{validator}} object in which
45+
#' @return [validate::validator()] object in which
4646
simplify_fixed_variables <- function(x, eps = 1e-8, ...){
4747
x <- check_validator(x)
4848
fv <- detect_fixed_variables(x, eps = eps, ...)

R/dnf.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,15 @@ fix_cat_domain <- function(rules){
262262
lapply(function(x){
263263
a <- sapply(x, \(x) 1)
264264
type <- sapply(x, \(x) "binary")
265-
mip_rule(a = a, op = "<=", b = 1, rule = "domain", type = type)
265+
mip_rule(a = a, op = "<=", b = 1, rule = ".domain.", type = type)
266266
})
267+
cv <-
268+
lapply(names(cv), function(n){
269+
mr <- cv[[n]]
270+
mr$rule <- paste0(".domain.", n)
271+
mr
272+
})
273+
267274
c(rules, unname(cv))
268275
}
269276

R/feasible.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' categorical and conditional rules in a rule set are consistent.
66
#'
77
#' @example ./examples/feasible.R
8-
#' @param x \code{validator} object with validation rules.
8+
#' @param x `validator` object with validation rules.
99
#' @param ... not used
1010
#' @family feasibility
1111
#' @return TRUE or FALSE
@@ -28,13 +28,13 @@ is_feasible <- function(x, ...){
2828
#'
2929
#' Make an infeasible system feasible, by removing the minimum (weighted) number of rules, such that the remaining
3030
#' rules are not conflicting.
31-
#' This function uses \code{\link{detect_infeasible_rules}} for determining the rules to be removed.
31+
#' This function uses [detect_infeasible_rules()] for determining the rules to be removed.
3232
#' @export
33-
#' @param x \code{\link{validator}} object with the validation rules.
34-
#' @param ... passed to \code{\link{detect_infeasible_rules}}
33+
#' @param x [validate::validator()] object with the validation rules.
34+
#' @param ... passed to [detect_infeasible_rules()]
3535
#' @family feasibility
3636
#' @example ./examples/feasible.R
37-
#' @return \code{\link{validator}} object with feasible rules.
37+
#' @return [validate::validator()] object with feasible rules.
3838
make_feasible <- function(x, ...){
3939
dropping <- detect_infeasible_rules(x, ...)
4040

@@ -54,12 +54,12 @@ make_feasible <- function(x, ...){
5454
#' to you than others. This can be mitigated by supplying weights for the rules. Default weight is 1.
5555
#' @export
5656
#' @example ./examples/feasible.R
57-
#' @param x \code{\link{validator}} object with rules
58-
#' @param weight optional named \code{\link{numeric}} with weights. Unnamed variables in the weight are given the default
59-
#' weight \code{1}.
57+
#' @param x [validate::validator()] object with rules
58+
#' @param weight optional named [numeric()] with weights. Unnamed variables in the weight are given the default
59+
#' weight `1`.
6060
#' @family feasibility
6161
#' @param ... not used
62-
#' @return \code{character} with the names of the rules that are causing infeasibility.
62+
#' @return `character` with the names of the rules that are causing infeasibility.
6363
detect_infeasible_rules <- function(x, weight = numeric(), ...){
6464
if (!is_infeasible(x)){
6565
return(character())

R/implied_by.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
#' Find out which rules are causing rule_name(s) to be redundant.
44
#' @example ./examples/redundancy.R
55
#' @export
6-
#' @param x \code{\link{validator}} object with rule
7-
#' @param rule_name \code{character} with the names of the rules to be checked
6+
#' @param x [validate::validator()] object with rule
7+
#' @param rule_name `character` with the names of the rules to be checked
88
#' @param ... not used
99
#' @family redundancy
10-
#' @return \code{character} with the names of the rule that cause the implication.
10+
#' @return `character` with the names of the rule that cause the implication.
1111
is_implied_by <- function(x, rule_name, ...){
1212
check_validator(x)
1313
idx <- match(rule_name, names(x), 0)

0 commit comments

Comments
 (0)