Skip to content

Commit 3d30581

Browse files
committed
updating vignette
1 parent 4644280 commit 3d30581

17 files changed

+83
-23
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: errorlocate
22
Type: Package
33
Title: Locate Errors with Validation Rules
4-
Version: 1.1.1
4+
Version: 1.1.2
55
Authors@R: c(person("Edwin", "de Jonge", email = "[email protected]", role = c("aut", "cre"), comment=c(ORCID="0000-0002-6580-4718")),
66
person("Mark", "van der Loo", email = "[email protected]", role = c("aut")))
77
Description: Errors in data can be located and removed using validation rules from package
@@ -21,7 +21,7 @@ Suggests:
2121
covr,
2222
knitr,
2323
rmarkdown
24-
RoxygenNote: 7.2.3
24+
RoxygenNote: 7.3.2
2525
Encoding: UTF-8
2626
Collate:
2727
'MipRules.R'

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Generated by roxygen2: do not edit by hand
22

33
S3method(as.character,dnf)
4+
S3method(as.character,mip_rule)
45
S3method(as.data.frame,errorlocation)
56
S3method(as.expression,dnf)
67
S3method(print,dnf)

R/MipRules.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' Create a mip object from a validator object
22
#'
3-
#' Create a mip object from [validator()] object.
3+
#' Create a mip object from [validate::validator()] object.
44
#' This is a utility class that translates a validor object into a mixed integer problem that
55
#' can be solved.
66
#' Most users should use [locate_errors()] which will handle all translation and execution

R/errorlocate-package.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' Find errors in data given a set of validation rules.
44
#' The `errorlocate` helps to identify obvious errors in raw datasets.
55
#'
6-
#' It works in tandem with the package [validate()].
6+
#' It works in tandem with the package `validate`.
77
#' With `validate` you formulate data validation rules to which the data must comply.
88
#' For example:
99
#'

R/errorlocation.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#'
1313
#'
1414
#' Current implementation assumes that errors are record based. The error locations can be retrieved
15-
#' using the method [values()] and are a matrix of
15+
#' using the method [validate::values()] and are a matrix of
1616
#' rows and columns, with the same dimensions are the `data.frame` that was checked.
1717
#' For errors that are purely column based, or dataset based, errorlocations will return a matrix with all
1818
#' rows or cells set to `TRUE`.
19-
#' The [values()] return `NA` for missing values.
19+
#' The [validate::values()] return `NA` for missing values.
2020

2121
#' @section Fields:
2222
#'

R/linear.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LOGS <- c("log", "log1p", "log10", "log2")
1010
#' categorical and conditional rules to be used in finding errors. Other rule types
1111
#' are ignored during error finding.
1212
#' @export
13-
#' @param x [validator()] object containing data validation rules
13+
#' @param x [validate::validator()] object containing data validation rules
1414
#' @param ... not used
1515
#' @return `logical` indicating which rules are (purely) linear.
1616
#' @family rule type

R/mip_lpsolve.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' @param rules mip rules
77
#' @param objective function
88
#' @param eps accuracy for equality/inequality
9-
#' @param ... additional [lp.control()] parameters that are set for the mip problem
9+
#' @param ... additional [lpSolveAPI::lp.control()] parameters that are set for the mip problem
1010
translate_mip_lp <- function( rules
1111
, objective=NULL
1212
, eps = 1e-3

R/mip_rule.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ mip_rule <- function(a, op, b, rule, type, weight=Inf, ...){
1818
)
1919
}
2020

21+
#' @export
2122
as.character.mip_rule <- function(x, ...){
2223
a <- paste0(x$a, "*", names(x$a), collapse= ' + ')
2324

@@ -29,6 +30,7 @@ as.character.mip_rule <- function(x, ...){
2930
paste0(a, " ",x$op, " ", x$b, sep = "")
3031
}
3132

33+
#' @export
3234
print.mip_rule <- function(x, ...){
3335
a <- paste0(x$a, "*", names(x$a), collapse= ' + ')
3436

R/replace-errors.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#' imputation method. Suggested values from the error localization method may introduce an undesired bias.
1616
#'
1717
#' @param data data to be checked
18-
#' @param x [validator()] or `errorlocation` object.
18+
#' @param x [validate::validator()] or `errorlocation` object.
1919
#' If an `errorlocation` is already available (through [locate_errors()]) this
2020
#' is more efficient.
2121
#' @param ref optional reference data set

R/soft-rule.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#TODO rename to mip_*
22

33
# convert statements of A == '1' into A + .delta_A == '1'
4+
# convert statements of a:a - b:b <= 0 into a:a - b:b - delta <= 0
45
soft_cat_rule <- function(x, prefix=".delta_", name = x$rule, ...){
56
stopifnot(inherits(x, "mip_rule"))
67
nm <- paste0(prefix, name, collapse = "")
78
delta <- setNames(1L, nm)
9+
neg <- min(sum(x$a[x$a < 0]), -1L)
10+
delta <- ifelse(x$op == "==", 1L, neg)
11+
delta <- setNames(delta, nm)
812
x$a <- c(x$a, delta)
913
x$type <- c(x$type, setNames("binary", nm))
1014
x

0 commit comments

Comments
 (0)