From 8f646636a412e9f927a974154c611b21c2aa430c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Feb 2026 01:52:28 +0000 Subject: [PATCH 1/3] Initial plan From 5a24b9d3bbc3cd93688b85558c777c71343202de Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Feb 2026 02:03:04 +0000 Subject: [PATCH 2/3] Fix maintainability and style issues in func_discord_data.R Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com> --- R/func_discord_data.R | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/R/func_discord_data.R b/R/func_discord_data.R index 11fbcf1..89db84f 100644 --- a/R/func_discord_data.R +++ b/R/func_discord_data.R @@ -98,7 +98,7 @@ discord_data_ram_optimized <- function(data, orderedOnOutcome <- do.call( rbind, lapply( - X = 1:nrow(data), + X = seq_len(nrow(data)), FUN = check_sibling_order, data = data, outcome = outcome, pair_identifiers = pair_identifiers @@ -106,17 +106,17 @@ discord_data_ram_optimized <- function(data, ) if (!valid_ids(orderedOnOutcome, - id = id + id = id )) { id <- "rowwise_id" - orderedOnOutcome <- cbind(orderedOnOutcome, rowwise_id = 1:nrow(data)) + orderedOnOutcome <- cbind(orderedOnOutcome, rowwise_id = seq_len(nrow(data))) } out <- vector(mode = "list", length = length(variables)) - for (i in 1:length(variables)) { + for (i in seq_along(variables)) { out[[i]] <- do.call(rbind, lapply( - X = 1:nrow(orderedOnOutcome), + X = seq_len(nrow(orderedOnOutcome)), FUN = make_mean_diffs, data = orderedOnOutcome, id = id, sex = sex, race = race, @@ -184,11 +184,11 @@ discord_data_ram_optimized <- function(data, } - return(output) + output } .clean_names <- function(df) { names(df) <- sub(".*\\.", "", names(df)) # If name has "prefix.name", keep only "name" - return(df) + df } #' @title Discord Data Fast #' @@ -220,13 +220,13 @@ discord_data_fast <- function(data, ) if (!valid_ids(orderedOnOutcome, - id = id + id = id )) { id_original <- id id <- "rowwise_id" orderedOnOutcome <- cbind(orderedOnOutcome, id_original = data[id_original], - rowwise_id = 1:nrow(data) + rowwise_id = seq_len(nrow(data)) ) } @@ -307,5 +307,5 @@ discord_data_fast <- function(data, } - return(output) + output } From c89772a110c176851f6d2ef88c3448243d9a0c37 Mon Sep 17 00:00:00 2001 From: Mason Garrison Date: Fri, 20 Feb 2026 21:11:40 -0500 Subject: [PATCH 3/3] Apply suggestion from @smasongarrison Signed-off-by: Mason Garrison --- R/func_discord_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/func_discord_data.R b/R/func_discord_data.R index 89db84f..a868526 100644 --- a/R/func_discord_data.R +++ b/R/func_discord_data.R @@ -107,7 +107,7 @@ discord_data_ram_optimized <- function(data, if (!valid_ids(orderedOnOutcome, id = id - )) { + )) { id <- "rowwise_id" orderedOnOutcome <- cbind(orderedOnOutcome, rowwise_id = seq_len(nrow(data))) }