also clean up occdownloadmeta print method by pulling out a cat method to use throughout bump pkg dev version
Showing 2 of 6 files from the diff.
R/occ_download_meta.R
changed.
Other files ignored by Codecov
tests/testthat/test-occ_download_meta.R
has changed.
DESCRIPTION
has changed.
@@ -32,15 +32,28 @@
Loading
32 | 32 | #' @export |
|
33 | 33 | print.occ_download_meta <- function(x, ...){ |
|
34 | 34 | stopifnot(inherits(x, 'occ_download_meta')) |
|
35 | - | cat("<<gbif download metadata>>", "\n", sep = "") |
|
36 | - | cat(" Status: ", x$status, "\n", sep = "") |
|
37 | - | cat(" Format: ", attr(x, 'format'), "\n", sep = "") |
|
38 | - | cat(" Download key: ", x$key, "\n", sep = "") |
|
39 | - | cat(" Created: ", x$created, "\n", sep = "") |
|
40 | - | cat(" Modified: ", x$modified, "\n", sep = "") |
|
41 | - | cat(" Download link: ", x$downloadLink, "\n", sep = "") |
|
42 | - | cat(" Total records: ", x$totalRecords, "\n", sep = "") |
|
43 | - | cat(" Request: ", gbif_make_list(x$request), "\n", sep = "") |
|
35 | + | cat_n("<<gbif download metadata>>") |
|
36 | + | cat_n(" Status: ", x$status) |
|
37 | + | cat_n(" Format: ", attr(x, 'format')) |
|
38 | + | cat_n(" Download key: ", x$key) |
|
39 | + | cat_n(" Created: ", x$created) |
|
40 | + | cat_n(" Modified: ", x$modified) |
|
41 | + | cat_n(" Download link: ", x$downloadLink) |
|
42 | + | cat_n(" Total records: ", n_with_status(x$totalRecords, x$status)) |
|
43 | + | cat_n(" Request: ", gbif_make_list(x$request)) |
|
44 | + | } |
|
45 | + | ||
46 | + | n_with_status <- function(n, status) { |
|
47 | + | # bail out if not numeric or integer |
|
48 | + | if (!inherits(n, c("numeric", "integer"))) return(n) |
|
49 | + | # return n if greater than zero |
|
50 | + | if (n > 0) return(n) |
|
51 | + | # if zero and still running return NA |
|
52 | + | if (!tolower(status) %in% c('succeeded', 'killed', 'cancelled')) { |
|
53 | + | return("<NA>") |
|
54 | + | } |
|
55 | + | # else return n |
|
56 | + | return(n) |
|
44 | 57 | } |
|
45 | 58 | ||
46 | 59 | gbif_make_list <- function(y){ |
@@ -74,12 +87,6 @@
Loading
74 | 87 | tmp$type, |
|
75 | 88 | if ("geometry" %in% names(tmp)) "geometry" else tmp$key, |
|
76 | 89 | sub_str(gg, 60) |
|
77 | - | # if ("geometry" %in% names(tmp)) { |
|
78 | - | # tmp$geometry |
|
79 | - | # } else { |
|
80 | - | # zz <- tmp$value %||% tmp$values |
|
81 | - | # if (!is.null(zz)) paste(zz, collapse = ",") else zz |
|
82 | - | # } |
|
83 | 90 | ) |
|
84 | 91 | } |
|
85 | 92 | } |
Files | Coverage |
---|---|
R | 76.27% |
Project Totals (55 files) | 76.27% |
358157520
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.