Skip to content

Commit

Permalink
Fix issue labelled rows in mult- functions
Browse files Browse the repository at this point in the history
Fix small bug with mult- function and labelled rows
  • Loading branch information
Japal committed Jun 18, 2024
1 parent cf11ec6 commit fdf344d
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: zCompositions
Type: Package
Title: Treatment of Zeros, Left-Censored and Missing Values in Compositional Data Sets
Version: 1.5.0-3
Date: 2024-03-13
Version: 1.5.0-4
Date: 2024-06-18
Authors@R:
c(person(given = "Javier",
family = "Palarea-Albaladejo",
Expand Down
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
RELEASE HISTORY OF THE "zCompositions" PACKAGE
==============================================

CHANGES IN zCompositions VERSION 1.5.0-4 [2024-06]:
----------------------------------------------------

MODIFICATIONS

* Fix small bug in mult- functions when using labelled rows.

CHANGES IN zCompositions VERSION 1.5.0-3 [2024-03]:
----------------------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions R/lrDA.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ lrDA <-
nn <- nrow(X); p <- ncol(X)
if (nn <= p) stop("The lrDA algorithm works on regular data sets (no. rows > no. columns). You can consider lrSVD for wide dat sets.")

rnames <- rownames(X)
X[X==label] <- NA
X <- apply(X,2,as.numeric)
rownames(X) <- rnames
c <- apply(X,1,sum,na.rm=TRUE)

checkNumZerosCol <- apply(X, 2, function(x) sum(is.na(x)))
Expand Down
2 changes: 2 additions & 0 deletions R/multKM.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ multKM <-
return(as.numeric(x))
}

rnames <- rownames(X)
X[X==label] <- NA
X <- apply(X,2,as.numeric)
rownames(X) <- rnames

checkNumZerosCol <- apply(X, 2, function(x) sum(is.na(x)))

Expand Down
2 changes: 2 additions & 0 deletions R/multLN.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ multLN <-
if (ncol(dl)!=ncol(X)) stop("The number of columns in X and dl do not agree")
if ((nrow(dl)>1) & (nrow(dl)!=nrow(X))) stop("The number of rows in X and dl do not agree")

rnames <- rownames(X)
X[X==label] <- NA
X <- apply(X,2,as.numeric)
rownames(X) <- rnames

checkNumZerosCol <- apply(X, 2, function(x) sum(is.na(x)))

Expand Down
2 changes: 2 additions & 0 deletions R/multRepl.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ multRepl <-
if (!is.null(names(X))) nam <- names(X)
if (is.vector(X)) X <- as.data.frame(matrix(X,ncol=length(X)),stringsAsFactors=TRUE)

rnames <- rownames(X)
X[X==label] <- NA
X <- apply(X,2,as.numeric)
if (!is.null(rownames(X))) {rownames(X) <- rnames} # Needed for the vector case
if (is.vector(X)) X <- as.data.frame(matrix(X,ncol=length(X)),stringsAsFactors=TRUE)

if (nrow(X) > 1){
Expand Down
4 changes: 2 additions & 2 deletions man/zCompositions-package.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Following compositional data analysis principles, this package provides simple a
\tabular{ll}{
Package: \tab zCompositions\cr
Type: \tab Package\cr
Version: \tab 1.5.0-3\cr
Date: \tab 2024-03-13\cr
Version: \tab 1.5.0-4\cr
Date: \tab 2024-06-18\cr
License: \tab GPL (>= 2)\cr
}
}
Expand Down

0 comments on commit fdf344d

Please sign in to comment.