diff --git a/R/impute.R b/R/impute.R index 3ecf60bf..c3bddbdd 100644 --- a/R/impute.R +++ b/R/impute.R @@ -106,23 +106,25 @@ impute <- function(data, ...) { noise_missing <- missing(noise) # check if argument noise was provided or not - if (method == "randomforest"){ + if (method == "randomforest") { data_wide <- data %>% tidyr::pivot_wider( - id_cols=sample, - names_from =grouping, - values_from = intensity_log2) %>% + id_cols = sample, + names_from = grouping, + values_from = intensity_log2 + ) %>% dplyr::select(sample) data_wide <- data.frame(lapply(data_wide, function(x) as.numeric(as.character(x)))) data_imputed_rf <- missForest(data_wide, ...) - data_imputed <-data_imputed_rf$ximp + data_imputed <- data_imputed_rf$ximp data_imputed[sample] <- data %>% tidyr::pivot_wider( id_cols = sample, names_from = grouping, - values_from = intensity_log2) %>% + values_from = intensity_log2 + ) %>% dplyr::pull(sample) data_imputed <- data_imputed %>%