Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
svkucheryavski committed Apr 23, 2021
2 parents a796daf + 49de1c8 commit 9b8a749
Show file tree
Hide file tree
Showing 23 changed files with 418 additions and 127 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mdatools
Title: Multivariate Data Analysis for Chemometrics
Version: 0.11.3
Date: 2021-01-21
Version: 0.11.4
Date: 2021-04-23
Author: Sergey Kucheryavskiy (<https://orcid.org/0000-0002-3145-7244>)
Maintainer: Sergey Kucheryavskiy <[email protected]>
Description: Projection based methods for preprocessing,
Expand Down
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
v.0.11.4
========

* added possibility for providing partially known contributions (parameter `cont.forced`) or spectral values (parameter `spec.forced`) to `mcrals()`. See more in help text and user guide for the package.

* added possibility to run iPLS using test set (parameters `x.test` and `y.test`) instead of cross-validation.

* added a possibility to provide user defined indices of the purest variables in `mcrpure()` instead of detecting them automatically.

* fixed bug [#98](https://github.com/svkucheryavski/mdatools/issues/98), which caused a drop of row names when data frame was used as a data source for PCA/SIMCA.

* fixed bug [#99](https://github.com/svkucheryavski/mdatools/issues/99), which did not allow to use user defined indices of pure variables in `mcrpure()`.


v.0.11.3
========

Expand Down
8 changes: 7 additions & 1 deletion R/constraints.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ constraints.list <- function() {
#' @export
constraintClosure <- function(x, d, sum = 1) {
stopifnot("Parameter 'sum' should be positive number." = sum > 0 )
s <- diag(sum / rowSums(x), nrow(x), nrow(x))

# if all values in a row are zeros set sums to one so they will not be scaled
rsums <- rowSums(x)
rsums[rsums == 0] <- 1

# scale the values so for evert row they sum up to 1
s <- diag(sum / rsums, nrow(x), nrow(x))
return(s %*% x)
}

Expand Down
Loading

0 comments on commit 9b8a749

Please sign in to comment.