yonicd / whereami
Showing 1 of 4 files from the diff.
Newly tracked file
R/counter.R changed.
Other files ignored by Codecov

@@ -22,45 +22,62 @@
Loading
22 22
#'  are reset.
23 23
#'
24 24
#'  `counter_get()` returns a table with all the counters. These can then
25 -
#'  be plotted with the `autoplot()` method.
26 -
#' @examples
25 +
#'  be plotted with the with the plot method.
26 +
#'
27 +
#'  A json log of the counter is written to file.path(tempdir(),'whereami.json') by default
28 +
#'  The path can be set using [set_whereami_log][whereami::set_whereami_log]
27 29
#'
28 -
#' if( interactive() ){
30 +
#' @examples
29 31
#'
30 32
#' tf <- tempfile(fileext = '.R')
31 33
#'
32 34
#' # call to write to temp file
33 -
#' f <- "whereami::cat_where(whereami::whereami(tag = 'my tag'))"
35 +
#' f1 <- "whereami::cat_where(whereami::whereami(tag = 'tag1'))"
36 +
#' f2 <- "whereami::cat_where(whereami::whereami(tag = 'tag2'))"
34 37
#'
35 38
#' # write to the file (call at line 3)
36 -
#' cat('\n\n',f,sep='',file = tf)
39 +
#' cat('\n\n',f1,'\n\n',f2,sep='',file = tf)
37 40
#'
38 41
#' source(tf)
39 42
#'
40 43
#' counter_state()
41 44
#'
42 -
#' counter_state(tag = 'my tag')
45 +
#' counter_state(tag = 'tag1')
43 46
#'
44 47
#' counter_names()
45 48
#'
49 +
#' counter_tags()
50 +
#'
51 +
#' counters <- counter_get()
52 +
#'
53 +
#' counters
54 +
#'
46 55
#' # using counter_reset and counter_names in a loop
47 56
#'
48 57
#' for( i in 1:10 ){
49 58
#'
50 59
#'   source(tf)
51 60
#'
52 -
#'   if( counter_state(counter_names()[1]) > 5 )
53 -
#'     counter_reset(counter_names()[1])
61 +
#'   if( counter_state(tag = 'tag1') > 5 )
62 +
#'     counter_reset(tag = 'tag2')
54 63
#' }
55 64
#'
65 +
#' plot(counter_get())
66 +
#'
67 +
#' # read the json log
68 +
#' jsonlite::read_json(
69 +
#' file.path(tempdir(),'whereami.json'),
70 +
#' simplifyVector = TRUE)
71 +
#'
56 72
#' # clear all counters
57 73
#' counter_reset()
58 74
#'
75 +
#' #verify that there are no active counters
76 +
#' counter_state()
77 +
#'
59 78
#' # cleanup
60 79
#' unlink(tf)
61 80
#'
62 -
#' }
63 -
#'
64 81
#' @rdname counter
65 82
#' @author Jonathan Sidi
66 83
#' @family counter
Files Coverage
R 34.01%
Project Totals (7 files) 34.01%
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