prioritizr / prioritizr
Showing 2 of 156 files from the diff.
Other files ignored by Codecov
docs/index.html has changed.
docs/pkgdown.yml has changed.
docs/404.html has changed.
docs/authors.html has changed.
README.md has changed.
NEWS.md has changed.
DESCRIPTION has changed.

@@ -290,17 +290,22 @@
Loading
290 290
    is.matrix(solution))
291 291
  # calculate amount of each feature in each planning unit
292 292
  total <- x$feature_abundances_in_total_units()
293 -
  held <-
294 -
    vapply(
295 -
      seq_len(x$number_of_zones()),
296 -
      FUN.VALUE = numeric(nrow(x$data$rij_matrix[[1]])),
297 -
      function(i) {
298 -
        rowSums(
299 -
          x$data$rij_matrix[[i]] *
300 -
            matrix(solution[, i], ncol = nrow(solution),
301 -
                   nrow = nrow(x$data$rij_matrix[[1]]), byrow = TRUE),
302 -
          na.rm = TRUE)
303 -
    })
293 +
  held <- vapply(
294 +
    seq_len(x$number_of_zones()),
295 +
    FUN.VALUE = numeric(nrow(x$data$rij_matrix[[1]])),
296 +
    function(i) {
297 +
      Matrix::rowSums(
298 +
        x$data$rij_matrix[[i]] *
299 +
        Matrix::Matrix(
300 +
          solution[, i],
301 +
          ncol = nrow(solution),
302 +
          nrow = nrow(x$data$rij_matrix[[1]]),
303 +
          byrow = TRUE,
304 +
          sparse = FALSE
305 +
        ),
306 +
        na.rm = TRUE
307 +
      )
308 +
  })
304 309
  # prepare output
305 310
  if (x$number_of_zones() == 1) {
306 311
    out <- tibble::tibble(
@@ -310,8 +315,8 @@
Loading
310 315
      absolute_held = unname(c(held)),
311 316
      relative_held = unname(c(held / total)))
312 317
  } else {
313 -
    total <- c(rowSums(total), c(total))
314 -
    held <- c(rowSums(held), c(held))
318 +
    total <- c(Matrix::rowSums(total), c(total))
319 +
    held <- c(Matrix::rowSums(held), c(held))
315 320
    out <- tibble::tibble(
316 321
      summary =
317 322
        rep(c("overall", x$zone_names()), each = x$number_of_features()),

@@ -931,14 +931,14 @@
Loading
931 931
    if (is.null(names(rij_matrix)))
932 932
      names(rij_matrix) <- as.character(seq_along(rij_matrix))
933 933
    # calculate feature abundances in total units
934 -
    fatu <- vapply(rij_matrix, rowSums, numeric(nrow(rij_matrix[[1]])),
934 +
    fatu <- vapply(rij_matrix, Matrix::rowSums, numeric(nrow(rij_matrix[[1]])),
935 935
                   na.rm = TRUE)
936 936
    if (!is.matrix(fatu))
937 937
      fatu <- matrix(fatu, nrow = nrow(features), ncol = length(rij_matrix))
938 938
    rownames(fatu) <- as.character(features$name)
939 939
    colnames(fatu) <- names(rij_matrix)
940 940
    # convert rij matrices to sparse format if needed
941 -
    pos <- which(rowSums(!is.na(x)) > 0)
941 +
    pos <- which(Matrix::rowSums(!is.na(x)) > 0)
942 942
    rij <- lapply(rij_matrix, function(z) {
943 943
      if (inherits(z, "dgCMatrix")) {
944 944
        z@x[which(is.na(z@x))] <- 0
@@ -1013,7 +1013,7 @@
Loading
1013 1013
      return(m)
1014 1014
    })
1015 1015
    # calculate feature abundances in total units
1016 -
    fatu <- vapply(rij, rowSums, numeric(number_of_features(features)),
1016 +
    fatu <- vapply(rij, Matrix::rowSums, numeric(number_of_features(features)),
1017 1017
                   na.rm = TRUE)
1018 1018
    if (!is.matrix(fatu))
1019 1019
      fatu <- matrix(fatu, nrow = number_of_features(features),
@@ -1021,8 +1021,9 @@
Loading
1021 1021
    rownames(fatu) <- feature_names(features)
1022 1022
    colnames(fatu) <- zone_names(features)
1023 1023
    # create rij matrix
1024 -
    pos <- which(rowSums(!is.na(as.matrix(
1025 -
             x2[, cost_column, drop = FALSE]))) > 0)
1024 +
    pos <- which(
1025 +
      rowSums(!is.na(as.matrix(x2[, cost_column, drop = FALSE]))) > 0
1026 +
    )
1026 1027
    rij <- lapply(rij, function(x) x[, pos, drop = FALSE])
1027 1028
    names(rij) <- zone_names(features)
1028 1029
    # create ConservationProblem object
Files Coverage
R 98.40%
src 98.22%
Project Totals (128 files) 98.34%
1
coverage:
2
  status:
3
    project:
4
      default:
5
        target: auto
6
        threshold: 20%
7
    patch:
8
      default:
9
        target: auto
10
        threshold: 20%
11
        informational: true
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