Showing 2 of 4 files from the diff.

@@ -35,7 +35,8 @@
Loading
35 35
#' @export
36 36
#' @name export_meshes
37 37
export_meshes <- function(meshcode) {
38 -
  df_meshes <- tibble::tibble("meshcode" = as.character(meshcode))
38 +
  df_meshes <-
39 +
    tibble::tibble("meshcode" = as.character(meshcode))
39 40
  sf::st_sf(df_meshes,
40 41
            geometry = purrr::map_chr(df_meshes$meshcode,
41 42
                                        ~ export_mesh(meshcode = .x) %>%
@@ -55,7 +56,8 @@
Loading
55 56
#'             stringsAsFactors = FALSE)
56 57
#' meshcode_sf(d, meshcode)
57 58
meshcode_sf <- function(data, mesh_var) {
58 -
  meshcode <- rlang::quo_name(rlang::enquo(mesh_var))
59 +
  meshcode <-
60 +
    rlang::quo_name(rlang::enquo(mesh_var))
59 61
  sf::st_sf(
60 62
    data,
61 63
    geometry = data %>%

@@ -23,21 +23,25 @@
Loading
23 23
  if (rlang::is_false(is_meshcode(meshcode))) {
24 24
    return(NA_character_)
25 25
  }
26 -
  from_mesh_size <- df_mesh_size_unit$mesh_size[which(df_mesh_size_unit$mesh_size == mesh_size(meshcode))] # nolint
26 +
  from_mesh_size <- 
27 +
    df_mesh_size_unit$mesh_size[which(df_mesh_size_unit$mesh_size == mesh_size(meshcode))] # nolint
27 28
    if (rlang::is_null(to_mesh_size))
28 29
      to_mesh_size <-
29 30
        units::drop_units(
30 31
          df_mesh_size_unit$mesh_size[which(df_mesh_size_unit$mesh_size == mesh_size(meshcode)) + 1]) # nolint
31 -
    to_mesh_size <- units::as_units(to_mesh_size, "km")
32 +
    to_mesh_size <-
33 +
      units::as_units(to_mesh_size, "km")
32 34
    if (from_mesh_size == to_mesh_size) {
33 35
      res <- meshcode
34 36
    } else if (from_mesh_size > to_mesh_size) {
35 37
      if (to_mesh_size == units::as_units(10, "km"))
36 -
        res <- grep(pattern = paste0("^(", meshcode, ")"),
37 -
                    x = meshcode_set_10km, value = TRUE)
38 +
        res <-
39 +
          grep(pattern = paste0("^(", meshcode, ")"),
40 +
               x = meshcode_set_10km, value = TRUE)
38 41
      if (to_mesh_size == units::as_units(1, "km"))
39 -
        res <- grep(pattern = paste0("^(", meshcode, ")"),
40 -
                    x = meshcode_set_1km, value = TRUE)
42 +
        res <-
43 +
          grep(pattern = paste0("^(", meshcode, ")"),
44 +
               x = meshcode_set_1km, value = TRUE)
41 45
      if (to_mesh_size <= units::as_units(0.500, "km"))
42 46
        res <- grep(pattern = paste0("^(",
43 47
                                     substr(meshcode, 1, 8),
@@ -80,32 +84,33 @@
Loading
80 84
                                     ")"),
81 85
                    x = meshcode_set_10km, value = TRUE)
82 86
      if (to_mesh_size == units::as_units(1, "km"))
83 -
        res <- grep(pattern = paste0("^(",
84 -
                                     substr(meshcode, 1, 8),
85 -
                                     ")"),
86 -
                    x = meshcode_set_1km, value = TRUE)
87 +
        res <- 
88 +
          grep(pattern = paste0("^(",
89 +
                                substr(meshcode, 1, 8),
90 +
                                ")"),
91 +
               x = meshcode_set_1km, value = TRUE)
87 92
      if (to_mesh_size <= units::as_units(0.500, "km"))
88 93
        res <-
89 -
        grep(pattern = paste0("^(",
90 -
                            substr(meshcode, 1, 9),
91 -
                            ")"),
92 -
           x = substr(fine_mesh_set, 1, 9), value = TRUE) %>%
93 -
        unique() %>%
94 -
        paste0(seq_len(4))
94 +
          grep(pattern = paste0("^(",
95 +
                                substr(meshcode, 1, 9),
96 +
                                ")"),
97 +
               x = substr(fine_mesh_set, 1, 9), value = TRUE) %>%
98 +
          unique() %>%
99 +
          paste0(seq_len(4))
95 100
      if (to_mesh_size <= units::as_units(0.250, "km"))
96 -
        res <-  grep(substr(meshcode, 1, 9),
97 -
                     res,
98 -
                     value = TRUE) %>%
99 -
          purrr::map(
100 -
            ~ paste0(.x, seq_len(4))) %>%
101 +
        res <-
102 +
          grep(substr(meshcode, 1, 9),
103 +
               res,
104 +
               value = TRUE) %>%
105 +
          purrr::map(~ paste0(.x, seq_len(4))) %>%
101 106
          purrr::reduce(c)
102 107
      if (to_mesh_size <= units::as_units(0.125, "km"))
103 -
        res <-  grep(substr(meshcode, 1, 10),
104 -
                     res,
105 -
                     value = TRUE) %>%
106 -
          purrr::map(
107 -
            ~ paste0(.x, seq_len(4))) %>%
108 -
          purrr::reduce(c)
108 +
        res <- # nocov start
109 +
          grep(substr(meshcode, 1, 10),
110 +
               res,
111 +
               value = TRUE) %>%
112 +
          purrr::map( ~ paste0(.x, seq_len(4))) %>%
113 +
          purrr::reduce(c) # nocov end
109 114
    }
110 115
    res
111 116
}
Files Coverage
R 97.27%
Project Totals (10 files) 97.27%
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