Skip to content

Commit

Permalink
Resolving devtools::check() warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
caitlinch committed Oct 29, 2024
1 parent fa17db0 commit 7a21016
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
9 changes: 3 additions & 6 deletions R/HierPoolPrev.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
#' you can use: \code{list(individual_sd = TRUE)}, which puts a prior on each
#' the standard deviations of each of group-level effects separately, but
#' doesn't change the priors used.
#'


HierPoolPrev <- function(data,result,poolSize,hierarchy,...,
prior = NULL,
Expand Down Expand Up @@ -186,7 +184,7 @@ HierPoolPrev <- function(data,result,poolSize,hierarchy,...,
cores = cores,
control = control)
#return(sfit)
sfit <- extract(sfit) %>% as_tibble() %>% rowwise()
sfit <- extract(sfit) %>% dplyr::as_tibble() %>% rowwise()

prevICC <- sfit %>%
transmute(prev = meanlinknormal(Intercept,
Expand All @@ -209,7 +207,7 @@ HierPoolPrev <- function(data,result,poolSize,hierarchy,...,
estimate.type = 'consistent'
}

out <- tibble::tibble(PrevBayes =
out <- dplyr::tibble(PrevBayes =
switch(estimate.type,
consistent = mean(prev),
zero = 0)
Expand All @@ -225,7 +223,7 @@ HierPoolPrev <- function(data,result,poolSize,hierarchy,...,
out$NumberOfPools <- sdata$N
out$NumberPositive <- sum(sdata$Result)

out$ICC <- ICC %>% apply(2, median) %>% t()
out$ICC <- ICC %>% apply(2, stats::median) %>% t()
out$ICC_CrILow <- ICC %>% apply(2, stats::quantile, probs = (1-level)/2) %>% t()
out$ICC_CrIHigh <- ICC %>% apply(2, stats::quantile, probs = (1+level)/2) %>% t()

Expand Down Expand Up @@ -300,4 +298,3 @@ print.HierPoolPrevOutput <- function(x, ...) {
print(formatted_output)
return(invisible(x))
}

5 changes: 1 addition & 4 deletions R/PoolPrev.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,11 @@
#' prevalence, \code{CLow} is the lower confidence/credible interval and
#' \code{CHigh} is the upper confidence/credible interval. When printed, the
#' prevalence estimate is represented as a percentage (i.e., per 100 units)
#'
#'
#' @seealso \code{\link{HierPoolPrev}}, \code{\link{getPrevalence}}
#'
#' @example examples/Prevalence.R



PoolPrev <- function(data,result,poolSize,...,
bayesian = TRUE, prior = NULL,
level = 0.95, reproduce.poolscreen = FALSE,
Expand Down Expand Up @@ -170,7 +167,7 @@ PoolPrev <- function(data,result,poolSize,...,
}

#initialise output object
out <- tibble::tibble(NumberOfPools = sdata$N,
out <- dplyr::tibble(NumberOfPools = sdata$N,
NumberPositive = sum(sdata$Result))

#if there is at least one positive and one negative result
Expand Down
9 changes: 6 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ extract_matrix_column_ICC <- function(cluster_var, x){
# Extract only the columns for this clustering variable
matrix_cols <- x %>%
select(grep("ICC", names(x), value = T))
cluster_cols <- as_tibble(lapply(names(matrix_cols),
function(x){matrix_cols[[x]][ , which(all_cluster_vars == cluster_var)]}),
.name_repair = "minimal")
cluster_cols <- tibble::as_tibble(
lapply(
names(matrix_cols),
function(x){matrix_cols[[x]][ , which(all_cluster_vars == cluster_var)]}
),
.name_repair = "minimal")
names(cluster_cols) <- paste0(cluster_var, ".", names(matrix_cols))
formatted_cluster_cols <- pretty_format_ICC_column(cluster_cols) # Pretty print
return(formatted_cluster_cols)
Expand Down
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ There may be 4 NOTEs depending on platform (and psuedo-random number generation)
* ```checking dependencies in R code ... NOTE
Namespace in Imports field not imported from: 'RcppParallel' 'rstantools'
All declared Imports should be used.```
PoolTestR *does* use both of these pacakges, so this NOTE is erroneous.
PoolTestR *does* use both of these packages, so this NOTE is erroneous.
* ```installed package size ... NOTE```
The large files appear to be in ```libs```, but the size appears to be highly platform dependent. On my local build this is only ~3 MB but in others it is >40 MB. I'm not sure how to avoid this issue and I am guessing it is largely outside of the scope of my package.

Expand Down

0 comments on commit 7a21016

Please sign in to comment.