Skip to content

Commit 127f53d

Browse files
authored
Merge pull request #1074 from pharmaverse/1072-general-code-refactoring
General code refactoring: remove duplicates, correct docs (#1072)
2 parents 126ed64 + 8551c52 commit 127f53d

17 files changed

+43
-99
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: aNCA
22
Title: (Pre-)Clinical NCA in a Dynamic Shiny App
3-
Version: 0.1.0.9101
3+
Version: 0.1.0.9102
44
Authors@R: c(
55
person("Ercan", "Suekuer", email = "ercan.suekuer@roche.com", role = "aut",
66
comment = c(ORCID = "0009-0001-1626-1526")),

R/PKNCA.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,8 @@ PKNCA_build_units_table <- function(o_conc, o_dose) { # nolint
634634
#' 1. Checks if the specified unit columns exist in the PKNCA object.
635635
#' 2. If a column does not exist, it creates the column and assigns default values.
636636
#' 3. If not default values are provided, it assigns NA to the new column.
637+
#' @keywords internal
638+
#' @noRd
637639
ensure_column_unit_exists <- function(pknca_obj, unit_name) {
638640
for (unit in unit_name) {
639641
if (is.null(pknca_obj$columns[[unit]])) {
@@ -659,6 +661,8 @@ ensure_column_unit_exists <- function(pknca_obj, unit_name) {
659661
#' @param df A data frame.
660662
#' @param strata_cols Column names in df whose unique combination defines the strata.
661663
#' @returns A data frame containing the strata columns and their minimal set of grouping columns.
664+
#' @keywords internal
665+
#' @noRd
662666
select_minimal_grouping_cols <- function(df, strata_cols) {
663667
# If there is no strata_cols specified, simply return the original df
664668
if (length(strata_cols) == 0) {
@@ -757,6 +761,8 @@ PKNCA_hl_rules_exclusion <- function(res, rules) { # nolint
757761
#' @examples
758762
#' # Suppose processed_pknca_data is a valid PKNCA data object
759763
#' # check_valid_pknca_data(processed_pknca_data)
764+
#' @keywords internal
765+
#' @noRd
760766
check_valid_pknca_data <- function(processed_pknca_data, check_exclusion_has_reason = TRUE) {
761767

762768
if (check_exclusion_has_reason) {

R/PKNCA_extra_parameters.R

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,18 @@ PKNCA::PKNCA.set.summary(
134134

135135

136136

137-
# Helper to generate missing-data checking messages for paired vectors
138-
#
139-
# This function accepts two columns/vectors (for example, concentrations
140-
# and volumes). It computes missingness internally and produces a character
141-
# vector of human-readable messages describing the missingness that matches
142-
# the style used in the package (used previously in `pk.calc.ae`).
137+
#' Generate missing-data checking messages for paired vectors
138+
#'
139+
#' Accepts two columns/vectors (e.g., concentrations and volumes), computes
140+
#' missingness, and returns human-readable messages describing it.
141+
#'
142+
#' @param a First vector.
143+
#' @param b Second vector.
144+
#' @param name_a Label for the first vector in messages.
145+
#' @param name_b Label for the second vector in messages.
146+
#' @returns Character vector of missingness messages (empty if none).
147+
#' @keywords internal
148+
#' @noRd
143149
generate_missing_messages <- function(a, b,
144150
name_a = deparse(substitute(a)),
145151
name_b = deparse(substitute(b))) {

R/g_pkcg.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ g_pkcg03_lin <- function(data, ...) {
651651
#' Wrapper around aNCA::pkcg03() function. Calls the function with `LOG` scale argument.
652652
#' @param data Data to be passed into the plotting function.
653653
#' @param ... Any other parameters to be passed into the plotting function.
654-
#' @returns ggplot2 object for pkcg01.
654+
#' @returns ggplot2 object for pkcg03.
655655
#' @export
656656
g_pkcg03_log <- function(data, ...) {
657657
pkcg03(adnca = data, scale = "LOG", ...)

R/officer-utils.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#' @param template Path to PowerPoint template file
88
#' @importFrom officer read_pptx add_slide ph_with ph_location_type
99
#' @return rpptx object
10+
#' @keywords internal
1011
create_pptx_doc <- function(path, title, template) {
1112
pptx <- read_pptx(template)
1213
add_pptx_sl_title(pptx, title)

R/pk_dose_qc_plot.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
#' colour_var_units = "DOSE_UNIT",
7171
#' title = "Sample Dosing and PK Plot"
7272
#' )
73-
#' @export
7473
pk_dose_qc_plot <- function(data_conc,
7574
data_dose = NULL,
7675
x_var,

R/ratio_calculations.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ multiple_matrix_ratios <- function(data, matrix_col, conc_col, units_col,
8383
#' @param custom_pptestcd Optional character. If provided, will be used as the PPTESTCD value.
8484
#' @returns A data.frame result object with the calculated ratios.
8585
#' @export
86-
#' @export
8786
calculate_ratios <- function(
8887
data,
8988
test_parameter,
@@ -95,7 +94,6 @@ calculate_ratios <- function(
9594
custom_pptestcd = NULL) {
9695
UseMethod("calculate_ratios", data)
9796
}
98-
#' @export
9997

10098
#' @export
10199
calculate_ratios.data.frame <- function(
@@ -231,7 +229,6 @@ calculate_ratios.data.frame <- function(
231229
select(any_of(c(names(df_test), "PPANMETH"))) %>%
232230
unique()
233231
}
234-
#' @export
235232

236233
#' @export
237234
calculate_ratios.PKNCAresults <- function(

inst/shiny/modules/common/download_code.R

Whitespace-only changes.

inst/shiny/modules/tab_nca/nca_results.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#' Module for displaying NCA results.
2+
#'
3+
#' Provides a parameter picker, units table, interactive results table with
4+
#' color-coded acceptance flags and a download button for the NCA output.
5+
#'
6+
#' @param id Module namespace ID.
7+
18
# nca_results UI Module
29
nca_results_ui <- function(id) {
310
ns <- NS(id)

inst/shiny/modules/tab_nca/parameter_datasets.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#' Module for viewing and downloading CDISC parameter datasets (PP, ADPP, ADNCA).
2+
#'
3+
#' Renders each dataset in an interactive table with CSV/XLSX download options.
4+
#'
5+
#' @param id Module namespace ID.
6+
17
parameter_datasets_ui <- function(id) {
28
ns <- NS(id)
39
navset_pill(

0 commit comments

Comments
 (0)