Skip to content

Commit

Permalink
Add sort method option
Browse files Browse the repository at this point in the history
o Add sort method option that defaults to "auto" on R versions < 3.3. See
  lgatto/MSnbase#180 for more info.
  • Loading branch information
jorainer committed Jan 3, 2017
1 parent 6ae5933 commit 8f1fc5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion R/functions-binning.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ binYonX <- function(x, y, breaks, nBins, binSize, binFromX,
stop("One of 'breaks', 'nBins' or 'binSize' has to be defined!")
if (!sortedX) {
message("'x' is not sorted, will sort 'x' and 'y'.")
o <- order(x, method = "radix")
## Sort method; see issue #180 for MSnbase
o <- order(x, method = options()$BioC$xcms$sortMethod)
x <- x[o]
y <- y[o]
}
Expand Down
7 changes: 6 additions & 1 deletion R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@

## getEIC method
getEIC.method="getEICOld"

## Sort method; see issue #180 for MSnbase
sortMeth <- "auto"
if (as.numeric(R.Version()$major) >= 3 & as.numeric(R.Version()$minor) >= 3)
sortMeth <- "radix"
xcms.opt <- list(findPeaks.method=findPeaks.method, findPeaks.methods=findPeaks.methods,
group.method=group.method, group.methods=group.methods,
retcor.method=retcor.method, retcor.methods=retcor.methods,
fillPeaks.method=fillPeaks.method, fillPeaks.methods=fillPeaks.methods,
specDist.methods=specDist.methods, getEIC.method=getEIC.method,
useOriginalCode = FALSE)
useOriginalCode = FALSE, sortMethod = sortMeth)

class(xcms.opt) <- "BioCPkg"

Expand Down

0 comments on commit 8f1fc5c

Please sign in to comment.