Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Na.rm option #283

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ SystemRequirements: C++11
NeedsCompilation: yes
URL: https://github.com/catavallejos/BASiCS
BugReports: https://github.com/catavallejos/BASiCS/issues
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Encoding: UTF-8
LazyData: false
Config/testthat/edition: 3
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ importFrom(stats,lag)
importFrom(stats,lm)
importFrom(stats,median)
importFrom(stats,model.matrix)
importFrom(stats,na.omit)
importFrom(stats,quantile)
importFrom(stats,rgamma)
importFrom(stats,rlnorm)
Expand Down
6 changes: 4 additions & 2 deletions R/Methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ setMethod(
#' the high posterior density interval (probabilty equal to \code{prob})
#'
#' @param x A \code{\linkS4class{BASiCS_Chain}} object.
#' @param ... Unused, only included for consistency with the generic.
#' @param prob \code{prob} argument for \code{\link[coda]{HPDinterval}}
#' function.
#' @param ... Unused, only included for consistency with the generic.
#' @param na.rm Unused, only included for consistency with the generic.
#'
#' @return An object of class \code{\linkS4class{BASiCS_Summary}}.
Expand All @@ -139,6 +139,7 @@ setMethod(
#'
#' @author Catalina A. Vallejos \email{cnvallej@@uc.cl}
#' @author Nils Eling \email{eling@@ebi.ac.uk}
#' @importFrom stats na.omit
#' @export
setMethod("Summary",
signature = "BASiCS_Chain",
Expand All @@ -158,7 +159,8 @@ setMethod("Summary",
dimnames = list(colnames(n), c("median", "lower", "upper"))
)
HPD[, 1] <- colMedians(n, na.rm = na.rm)
HPD[, 2:3] <- apply(n, 2, function(col) {
ind_not_na <- !is.na(HPD[, 1])
HPD[ind_not_na, 2:3] <- apply(n[, ind_not_na, drop=FALSE], 2, function(col) {
if (na.rm) {
col <- na.omit(col)
# avoid coda error for no samples
Expand Down
1 change: 0 additions & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
## This assume that we can call Rscript to ask Rcpp about its locations
## Use the R_HOME indirection to support installations of multiple R version
CXX_STD = CXX11
PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
1 change: 0 additions & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
## This assume that we can call Rscript to ask Rcpp about its locations
## Use the R_HOME indirection to support installations of multiple R version
CXX_STD = CXX11
PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
Loading