Skip to content

Commit

Permalink
Fix group_var name and add ungroup
Browse files Browse the repository at this point in the history
  • Loading branch information
johanna0321 committed May 17, 2024
1 parent 3c805e5 commit e894a85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions R/mutate_mzroll_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ normalize_peaks_median_polish <- function(mzroll_list,
median_polish_predict_dilutions <- function(mzroll_list,
scaling_factor = "median_polish_scaling_factor",
norm_scale_varname = "median_polish_predicted_dilutions",
group_vars = NULL) {
group_var = NULL) {

test_mzroll_list(mzroll_list)

Expand All @@ -489,10 +489,10 @@ median_polish_predict_dilutions <- function(mzroll_list,
dplyr::mutate(temp_scaling_factor = !!rlang::sym(scaling_factor)) %>%
dplyr::mutate(inverse_log_scaling_factor = 2^temp_scaling_factor)

if(!is.null(group_vars) && any(group_vars %in% colnames(mzroll_list$samples))) {
if(!is.null(group_var) && any(group_var %in% colnames(mzroll_list$samples))) {

updated_samples <- updated_samples %>%
dplyr::group_by_at(group_vars) %>%
dplyr::group_by_at(group_var) %>%
dplyr::mutate(m = max(inverse_log_scaling_factor))

} else {
Expand Down Expand Up @@ -1096,7 +1096,8 @@ normalize_peaks_center <- function (mzroll_list,
updated_measurements <- mzroll_list$measurements %>%
dplyr::group_by(groupId) %>%
dplyr::mutate(!!rlang::sym(norm_peak_varname) :=
scale(!!rlang::sym(quant_peak_varname), scale = F, center = T))
scale(!!rlang::sym(quant_peak_varname), scale = F, center = T)) %>%
dplyr::ungroup()

mzroll_list <- romic::update_tomic(mzroll_list, updated_measurements)

Expand Down
2 changes: 1 addition & 1 deletion man/median_polish_predict_dilutions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e894a85

Please sign in to comment.