Skip to content

Commit

Permalink
Added extra algorithms to rrollup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Drucker committed Jul 22, 2024
1 parent 3c0a8b2 commit 00019a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions R/rollup.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#' @importFrom Biobase exprs fData
#' @importFrom outliers grubbs.test outlier
#' @importFrom stats rnorm aggregate
#' @importFrom rlang as_function
#' @export rrollup
#'
#' @examples
Expand All @@ -29,7 +30,7 @@


rrollup <- function(msnset, rollBy, rollFun,
algorithm = c("reference", "sum"),
algorithm = c("reference", "sum", "median", "mean", "min", "max"),
verbose=TRUE){

algorithm <- match.arg(algorithm)
Expand All @@ -46,13 +47,12 @@ rrollup <- function(msnset, rollBy, rollFun,
}
exprs.new <- do.call(rbind, summarisedFeatures)
rownames(exprs.new) <- unique_rollBy
}
if(algorithm == "sum"){
} else {
temp <- data.frame(rollBy = fData(msnset)[[rollBy]],
exprs(msnset),
check.names = FALSE)
temp[is.na(temp)] <- 0
temp <- aggregate(. ~ rollBy, temp, sum)
temp <- aggregate(. ~ rollBy, temp, as_function(algorithm))
temp[temp == 0] <- NA
exprs.new <- as.matrix(temp[,-1])
rownames(exprs.new) <- temp[,1]
Expand Down
2 changes: 1 addition & 1 deletion man/rrollup.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 00019a5

Please sign in to comment.