a-maldet / labelmachine
Showing 2 of 4 files from the diff.
Newly tracked file
R/composerr.R changed.
Newly tracked file
R/lappli.R changed.
Other files ignored by Codecov
man/composerr.Rd has changed.
man/lapplI.Rd has changed.

@@ -47,22 +47,6 @@
Loading
47 47
#'   concatenation of `text_2` at the end of the error message.
48 48
#' @return A new error handling function that has an extended error message.
49 49
#' @rdname composerr
50 -
#' @examples 
51 -
#' \dontrun{
52 -
#' # ------     composerr_ in flat situation      ----------
53 -
#' # -- create a modified error handler in the same scope --
54 -
#' # check if variable 'obj' exists and holds value TRUE
55 -
#' obj <- FALSE
56 -
#' # original error handler
57 -
#' err_h <- composerr_("Something is wrong with obj")
58 -
#' if (!exists("obj"))
59 -
#'   err_h("obj does not exist")
60 -
#' # create more precise error handler (same scope)
61 -
#' err_h2 <- composerr_("obj has wrong value", "err_h")
62 -
#' if (!obj)
63 -
#'   err_h2("Value is FALSE")
64 -
#' #--- resulting error ---
65 -
#' # "Something is wrong with obj: obj has wrong value: Value is FALSE"}
66 50
composerr_ <- function(
67 51
  text_1 = NULL,
68 52
  err_prior = NULL,
@@ -124,22 +108,6 @@
Loading
124 108
}
125 109
126 110
#' @rdname composerr
127 -
#' @examples 
128 -
#' \dontrun{
129 -
#' # ------      composerr in flat situation      ----------
130 -
#' # -- create a modified error handler in the same scope --
131 -
#' # check if variable 'obj' exists and holds value TRUE
132 -
#' obj <- FALSE
133 -
#' # original error handler
134 -
#' err_h <- composerr("Something is wrong with obj")
135 -
#' if (!exists("obj"))
136 -
#'   err_h("obj does not exist")
137 -
#' # create more precise error handler (same scope)
138 -
#' err_h2 <- composerr("obj has wrong value", err_h)
139 -
#' if (!obj)
140 -
#'   err_h2("Value is FALSE")
141 -
#' #--- resulting error ---
142 -
#' # "Something is wrong with obj: obj has wrong value: Value is FALSE"}
143 111
composerr <- function(
144 112
  text_1 = NULL,
145 113
  err_prior = NULL,
@@ -170,24 +138,6 @@
Loading
170 138
}
171 139
172 140
#' @rdname composerr
173 -
#' @examples
174 -
#' \dontrun{
175 -
#' # ------  composerr_parent in nested situation   --------
176 -
#' # -- overwrite error handler in the deeper level scope --
177 -
#' # check if all entries of the list object 'obj' are TRUE
178 -
#' obj <- list(x = TRUE, y = TRUE, z = FALSE)
179 -
#' # original error handler
180 -
#' err_h <- composerr("obj is invalid")
181 -
#' # check each list element 
182 -
#' sapply(names(obj), function(name) {
183 -
#'   # modify error handler to nested sitation
184 -
#'   err_h <- composerr_parent(paste("Error in", name), err_h)
185 -
#'   # check element and throw error FALSE
186 -
#'   if (!obj[[name]])
187 -
#'     err_h("Value is FALSE")
188 -
#' })
189 -
#' #--- resulting error ---
190 -
#' # "obj is invalid: Error in z: Value is FALSE"}
191 141
composerr_parent <- function(
192 142
  text_1 = NULL,
193 143
  err_prior = NULL,

@@ -17,20 +17,6 @@
Loading
17 17
#'   Besides this extra feature, there is no difference to [base::lapply()] and
18 18
#'   [base::sapply()].
19 19
#' @inheritParams base::lapply
20 -
#' @examples
21 -
#' # 'lapply' with index
22 -
#' lapplI(
23 -
#'   list("x1", "x2"),
24 -
#'   function(x, y, .I) list(x = x, y = y, i = .I),
25 -
#'   y = "extra argument"
26 -
#' )
27 -
#'
28 -
#' # 'lapply' without index
29 -
#' lapplI(
30 -
#'   list("x1", "x2"),
31 -
#'   function(x, y) list(x = x, y = y),
32 -
#'   y = "extra argument"
33 -
#' )
34 20
#' @rdname lapplI
35 21
#' @export
36 22
lapplI <- function(X, FUN, ...) {
@@ -59,22 +45,6 @@
Loading
59 45
}
60 46
61 47
#' @inheritParams base::sapply
62 -
#' @examples
63 -
#' # 'sapply' with index
64 -
#' sapplI(
65 -
#'   c("x1", "x2"),
66 -
#'   function(x, y, .I) paste(x, y, .I),
67 -
#'   y = "extra argument",
68 -
#'   USE.NAMES = FALSE
69 -
#' )
70 -
#'
71 -
#' # 'sapply' without index
72 -
#' sapplI(
73 -
#'   c("x1", "x2"),
74 -
#'   function(x, y) paste(x, y),
75 -
#'   y = "extra argument",
76 -
#'   USE.NAMES = FALSE
77 -
#' )
78 48
#' @rdname lapplI
79 49
#' @export
80 50
sapplI <- function(X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE) {
Files Coverage
R 81.44%
Project Totals (12 files) 81.44%
1
comment: false
2

3
coverage:
4
  status:
5
    project:
6
      default:
7
        target: auto
8
        threshold: 1%
9
    patch:
10
      default:
11
        target: auto
12
        threshold: 1%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading