From 2feb1a4214912b9d5f9d078916067813e4e65fca Mon Sep 17 00:00:00 2001 From: elena-krismer Date: Thu, 10 Oct 2024 09:19:17 +0000 Subject: [PATCH] Style code (GHA) --- R/impute_randomforest.R | 5 ++--- tests/testthat/test-workflow.R | 16 ++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/R/impute_randomforest.R b/R/impute_randomforest.R index 68b283a..a860de5 100644 --- a/R/impute_randomforest.R +++ b/R/impute_randomforest.R @@ -76,8 +76,7 @@ impute_randomforest <- function( grouping, intensity_log2, retain_columns = NULL, - ... -) { + ...) { # Convert inputs to symbols sample_sym <- rlang::ensym(sample) grouping_sym <- rlang::ensym(grouping) @@ -90,7 +89,7 @@ impute_randomforest <- function( names_from = !!grouping_sym, values_from = !!intensity_sym ) %>% - dplyr::select(-!!sample_sym) # Exclude the sample column for imputation + dplyr::select(-!!sample_sym) # Exclude the sample column for imputation # Convert to numeric and suppress warnings for coercion data_wide <- suppressWarnings(data.frame(lapply(data_wide, function(x) as.numeric(as.character(x))))) diff --git a/tests/testthat/test-workflow.R b/tests/testthat/test-workflow.R index 27d2e91..8e82c1a 100644 --- a/tests/testthat/test-workflow.R +++ b/tests/testthat/test-workflow.R @@ -795,17 +795,17 @@ test_that("calculate_aa_scores works", { # Test for random forest imputation test_that("Random Forest imputation works correctly", { - set.seed(123) # Set seed for reproducibility + set.seed(123) # Set seed for reproducibility # Create synthetic test data test_data <- create_synthetic_data( - n_proteins = 10, - frac_change = 0.5, - n_replicates = 4, - n_conditions = 2, - method = "effect_random", - additional_metadata = FALSE - ) + n_proteins = 10, + frac_change = 0.5, + n_replicates = 4, + n_conditions = 2, + method = "effect_random", + additional_metadata = FALSE + ) # Perform imputation using the random forest method imputed_data <- impute_randomforest(