Skip to content

Commit

Permalink
update the if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
maotian06 committed Aug 21, 2024
1 parent a2bff06 commit bff018c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions R/calculate.scaling.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ calculate.scaling <- function(data.matrices) {
return(list(
center = apply(data.matrices, 1, mean),
scale = apply(data.matrices, 1, sd)
));
} else if ('list' == class(data.matrices)) {
# if there are multiple data types to scale
# return the mean and sd of each row for each data matrix
scaling.factors <- list();
for (data.type in names(data.matrices)) {
scaling.factors[[data.type]] <- calculate.scaling(data.matrices[[data.type]]);
}
return(scaling.factors);
} else {
# if not a list or a matrix return an error message to let the user know how to correct the input
stop('`data.matrices` must be a matrix, a data frame or a list');
))
if ('list' == class(data.matrices)) {
# if there are multiple data types to scale
# return the mean and sd of each row for each data matrix
scaling.factors <- list();
for(data.type in names(data.matrices)) {

Check warning on line 13 in R/calculate.scaling.R

View workflow job for this annotation

GitHub Actions / CICD-base

Place a space before left parenthesis, except in a function call.

Check warning on line 13 in R/calculate.scaling.R

View workflow job for this annotation

GitHub Actions / CICD-base

Place a space before left parenthesis, except in a function call.
scaling.factors[[data.type]] <- calculate.scaling(data.matrices[[data.type]]);
}
return(scaling.factors);
}
# if `data.matrices` is not a list, a matrix, or a data.frame return an error message to let the user know how to correct the input
stop('`data.matrices` must be a matrix, a data frame or a list');
}
}

Check warning on line 21 in R/calculate.scaling.R

View workflow job for this annotation

GitHub Actions / CICD-base

Missing terminal newline.

Check warning on line 21 in R/calculate.scaling.R

View workflow job for this annotation

GitHub Actions / CICD-base

Missing terminal newline.

0 comments on commit bff018c

Please sign in to comment.