Skip to content

Commit

Permalink
Fixed TB comments
Browse files Browse the repository at this point in the history
  • Loading branch information
antagomir committed Jul 1, 2024
1 parent 5a4f4f6 commit a175b3a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions R/decostand.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@

## Modified from the original version in mia R package
.calc_clr <-
function(x, na.rm, pseudocount=0)
function(x, na.rm, pseudocount=0, ...)
{

# Add pseudocount
Expand All @@ -180,7 +180,7 @@
clog <- clog - means

# Replace missing values with 0
if (na.rm) {
if (na.rm && any(is.na(clog))) {
message("Replacing missing values with zero for clr. You can disable this with na.rm=FALSE.")
clog[is.na(clog)] <- 0
}
Expand Down Expand Up @@ -231,18 +231,15 @@

}




.calc_alr <-
function (x, na.rm, pseudocount = 0, reference = 1)
function (x, na.rm, pseudocount = 0, reference = 1, ...)
{
# Add pseudocount
x <- x + pseudocount
# If there is negative values, gives an error.
# Always na.rm=TRUE at this step
if (any(x <= 0, na.rm = TRUE)) {
stop("'alr' cannot be used with non-positive data: use pseudocount >= ",
stop("'alr' cannot be used with non-positive data: use pseudocount > ",
-min(x, na.rm = na.rm) + pseudocount, call. = FALSE)
}
## name must be changed to numeric index for [-reference,] to work
Expand All @@ -259,7 +256,7 @@
clog <- clog[, -reference] - refvector

# Replace missing values with 0
if (na.rm) {
if (na.rm && any(is.na(clog))) {
message("Replacing missing values with zero for alr. You can disable this with na.rm=FALSE.")
clog[is.na(clog)] <- 0
}
Expand Down

0 comments on commit a175b3a

Please sign in to comment.