mkearney / tfse
Showing 1 of 5 files from the diff.
Newly tracked file
R/cat_line.R created.
Other files ignored by Codecov

@@ -0,0 +1,77 @@
Loading
1 +
2 +
3 +
#' Combine and print text
4 +
#'
5 +
#' \code{cat_lines}: concatenate/print \strong{multiple} line
6 +
#'
7 +
#' @param ... Text to print and/or named arguments such as sep, collapse, fill,
8 +
#'   indent, postdent.
9 +
#' @return Prints text and returns NULL similar to the base cat function
10 +
#' @export
11 +
cat_lines <- function(...) UseMethod("cat_lines")
12 +
13 +
#' @export
14 +
cat_lines.default <- function(...) {
15 +
  args <- as.list(c(
16 +
    dots_unnamed(...),
17 +
    add_arg_if(
18 +
      dots_named(...),
19 +
      sep = "",
20 +
      collapse = "\n",
21 +
      fill = TRUE,
22 +
      indent = "",
23 +
      postdent = "")
24 +
  ))
25 +
  do.call(catlines_, args)
26 +
}
27 +
28 +
#' Combine and print text
29 +
#'
30 +
#' \code{cat_line}: concatenate/print \strong{single} line
31 +
#'
32 +
#' @rdname cat_lines
33 +
#' @inheritParams cat_lines
34 +
#' @export
35 +
cat_line <- function(...) UseMethod("cat_line")
36 +
37 +
#' @export
38 +
cat_line.default <- function(...) {
39 +
  args <- as.list(c(
40 +
    dots_unnamed(...),
41 +
    add_arg_if(
42 +
      dots_named(...),
43 +
      sep = "",
44 +
      collapse = "",
45 +
      fill = TRUE,
46 +
      indent = "",
47 +
      postdent = "")
48 +
  ))
49 +
  do.call(catlines_, args)
50 +
}
51 +
52 +
dots_named <- function(...) {
53 +
  dots <- as.list(list(...))
54 +
  if (is.null(names(dots))) {
55 +
    return(list())
56 +
  }
57 +
  dots[names(dots) != ""]
58 +
}
59 +
dots_unnamed <- function(...) {
60 +
  dots <- as.list(list(...))
61 +
  if (!is.null(names(dots))) {
62 +
    dots <- dots[names(dots) == ""]
63 +
  }
64 +
  lapply(dots, unlist)
65 +
}
66 +
67 +
catline_ <- function(..., sep, collapse, fill, indent, postdent) {
68 +
  x <- paste(dots_unnamed(...), sep = sep)
69 +
  x <- paste0(indent, x, postdent)
70 +
  cat(paste(x, collapse = collapse), fill = fill)
71 +
}
72 +
73 +
catlines_ <- function(..., sep, collapse, fill, indent, postdent) {
74 +
  x <- lapply(dots_unnamed(...), function(.x)
75 +
    paste0(indent, .x, postdent, collapse = sep))
76 +
  cat(paste(x, collapse = collapse), fill = fill)
77 +
}
Files Coverage
R 68.68%
Project Totals (41 files) 68.68%
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