Skip to content

Commit

Permalink
Merge pull request #54 from Merck/DEVR-3501-Remove-row-with-no-observ…
Browse files Browse the repository at this point in the history
…ation

DEVR-3501: metalite.sl: Remove row with no observation on the interactive baseline table (Updated)
  • Loading branch information
wangben718 authored Dec 20, 2024
2 parents 4f223db + c14d87a commit 46d69a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/react_subgroup_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ react_subgroup_table <- function(
formatted_data <- tbl[, selected_columns]

# Remove row with no observation
# formatted_data <- formatted_data[which(rowSums(formatted_data[, grepl("n_", colnames(formatted_data))]) > 0), ]
formatted_data1 <- formatted_data[1:4, ]
formatted_data2 <- formatted_data[5:nrow(formatted_data), ]
formatted_data2 <- formatted_data2[which(rowSums(formatted_data2[, grepl("n_", colnames(formatted_data2))]) > 0), ]
formatted_data <- rbind(formatted_data1, formatted_data2)

prop_prefix <- paste0(subgroup_name, "prop_")
n_prefix <- paste0(subgroup_name, "n_")
Expand Down Expand Up @@ -76,6 +79,9 @@ react_subgroup_table <- function(
col_group_defs <- append(col_group_defs, list(reactable::colGroup(name = group[i], columns = c(n_name, prop_name, prop_num_name))))
}

# Row 4 is the empty row to separate summary and specified AE, leave columns as empty
formatted_data[4, ] <- NA

formatted_data <- formatted_data |> dplyr::select(dplyr::all_of(all_columns))

reactable::reactable(
Expand Down

0 comments on commit 46d69a2

Please sign in to comment.