From 1fc552e9a3fef768679ca38f88aa4b08fe24291e Mon Sep 17 00:00:00 2001 From: Witold Wolski Date: Tue, 14 May 2024 14:11:35 +0200 Subject: [PATCH] fix error in examples --- R/tidyMS_R6_Modelling.R | 2 +- R/tidyMS_missigness_V2.R | 14 +++++++------- man/MissingHelpers.Rd | 10 +++++----- man/build_models.Rd | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/tidyMS_R6_Modelling.R b/R/tidyMS_R6_Modelling.R index 446ef680..e1260b7a 100644 --- a/R/tidyMS_R6_Modelling.R +++ b/R/tidyMS_R6_Modelling.R @@ -3,7 +3,7 @@ #' @export #' @keywords internal #' @examples -#' mod <- build_models(model = " ~ Treatment * Background", weight_missing = 1) +#' mod <- build_models(model = "interaction", weight_missing = 1) #' stopifnot(dim(mod$modelDF) == c(10,9)) #' build_models <- function(model = c("factors", "interaction"), Nprot = 10, with_missing = TRUE, weight_missing = 1) { diff --git a/R/tidyMS_missigness_V2.R b/R/tidyMS_missigness_V2.R index 4cdb36f5..df22d03b 100644 --- a/R/tidyMS_missigness_V2.R +++ b/R/tidyMS_missigness_V2.R @@ -7,11 +7,11 @@ #' Contrasts <- c("group.b-a" = "group_A - group_B", "group.a-ctrl" = "group_A - group_Ctrl") #' dd <- prolfqua::sim_lfq_data_protein_config(Nprot = 100,weight_missing = 2) #' mh <- prolfqua::MissingHelpers$new(dd$data, dd$config, prob = 0.8,weighted = TRUE) -#' mh$get_stats() -#' mh$get_LOD() -#' mh$impute_weighted_lod() -#' mh$impute_lod() -#' mh$get_poolvar() +#' xx <- mh$get_stats() +#' xx <- mh$get_LOD() +#' xx <- mh$impute_weighted_lod() +#' xx <- mh$impute_lod() +#' xx <- mh$get_poolvar() #' bb <- mh$get_contrast_estimates(Contrasts) #' mh$get_contrasts(Contrasts) #' @@ -112,8 +112,8 @@ MissingHelpers <- R6::R6Class( meandf$sd <- ifelse(meandf$sd > 0, meandf$sd, minsd) meandf$sdT <- ifelse(meandf$sdT > 0, meandf$sdT, minsd) - pooled <- pooled |> mutate(sd = ifelse(is.na(sd) ,meandf$sd, sd)) - pooled <- pooled |> mutate(sdT = ifelse(is.na(sdT) , meandf$sdT, sdT )) + pooled <- pooled |> mutate(sd = ifelse(is.na(sd) | sd == 0 ,meandf$sd, sd)) + pooled <- pooled |> mutate(sdT = ifelse(is.na(sdT) | sdT == 0, meandf$sdT, sdT )) pooled <- pooled |> mutate(df = ifelse(df == 0, 1, df)) return(pooled) }, diff --git a/man/MissingHelpers.Rd b/man/MissingHelpers.Rd index 253751b3..56414e08 100644 --- a/man/MissingHelpers.Rd +++ b/man/MissingHelpers.Rd @@ -15,11 +15,11 @@ weight lod by nr of NA's $(LOD * nrNas + meanAbundance *nrObs)/(nrMeasured)$ Contrasts <- c("group.b-a" = "group_A - group_B", "group.a-ctrl" = "group_A - group_Ctrl") dd <- prolfqua::sim_lfq_data_protein_config(Nprot = 100,weight_missing = 2) mh <- prolfqua::MissingHelpers$new(dd$data, dd$config, prob = 0.8,weighted = TRUE) -mh$get_stats() -mh$get_LOD() -mh$impute_weighted_lod() -mh$impute_lod() -mh$get_poolvar() +xx <- mh$get_stats() +xx <- mh$get_LOD() +xx <- mh$impute_weighted_lod() +xx <- mh$impute_lod() +xx <- mh$get_poolvar() bb <- mh$get_contrast_estimates(Contrasts) mh$get_contrasts(Contrasts) diff --git a/man/build_models.Rd b/man/build_models.Rd index 5a061112..b04de988 100644 --- a/man/build_models.Rd +++ b/man/build_models.Rd @@ -15,7 +15,7 @@ build_models( build dataframe with models for testing } \examples{ -mod <- build_models(model = " ~ Treatment * Background", weight_missing = 1) +mod <- build_models(model = "interaction", weight_missing = 1) stopifnot(dim(mod$modelDF) == c(10,9)) }