Skip to content

Commit 7e7162c

Browse files
authored
Merge pull request #1566 from exploratory-io/fix/pca-report-37268
PCA analysis_conditions updates for #37268
2 parents 1580a0f + 9f0e8b5 commit 7e7162c

3 files changed

Lines changed: 25 additions & 16 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: exploratory
22
Type: Package
33
Title: R package for Exploratory
4-
Version: 16.0.16
5-
Date: 2026-07-25
4+
Version: 16.0.17
5+
Date: 2026-07-26
66
Authors@R: c(person("Hideaki", "Hayashi", email = "hideaki@exploratory.io", role = c("aut", "cre")), person("Hide", "Kojima", email = "hide@exploratory.io", role = c("aut")), person("Kan", "Nishida", email = "kan@exploratory.io", role = c("aut")), person("Kei", "Saito", email = "kei@exploratory.io", role = c("aut")), person("Yosuke", "Yasuda", email = "double.y.919.quick@gmail.com", role = c("aut")))
77
URL: https://github.com/exploratory-io/exploratory_func
88
Description: Functions for Exploratory

R/prcomp.R

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -338,40 +338,40 @@ tidy.prcomp_exploratory <- function(x, type="variances", n_sample=NULL, pretty.n
338338
normalized <- isTRUE(x$normalize_data)
339339
variables_used <- length(d$variable_sd)
340340
excluded_names <- d$excluded_variables
341-
excluded_display <- if (length(excluded_names) == 0) "-" else paste(excluded_names, collapse = ", ")
341+
# #37268: show "None" (JA: なし) when nothing was excluded, not "-".
342+
excluded_display <- if (length(excluded_names) == 0) "None" else paste(excluded_names, collapse = ", ")
342343
excluded_pct <- d$excluded_row_rate * 100
343344
scale_ratio <- d$scale_ratio
344345
scale_display <- if (is.na(scale_ratio)) "-" else format(round(scale_ratio, 1), nsmall = 1)
345346
scale_status <- if (!normalized && is.finite(scale_ratio) && scale_ratio >= cfg$scale_ratio_warning) "scale_warning" else "ok"
347+
# #37268: rename Rows Used / Variables Used; drop redundant Rows vs Variables row;
348+
# refresh Description copy (and English-canonical strings for the client translator).
346349
res <- tibble::tibble(
347-
Metric = c("Rows Used", "Rows Excluded", "Variables Used", "Excluded Variables",
348-
"Normalization", "SD Ratio (Max/Min)", "Rows vs Variables"),
350+
Metric = c("Row Count", "Rows Excluded", "Number of Variables", "Excluded Variables",
351+
"Normalization", "SD Ratio (Max/Min)"),
349352
Value = c(
350353
as.character(d$analyzed_row_count),
351354
paste0(d$excluded_row_count, " (", format(round(excluded_pct, 1), nsmall = 1), "%)"),
352355
as.character(variables_used),
353356
excluded_display,
354357
if (normalized) "Yes" else "No",
355-
scale_display,
356-
paste0(d$analyzed_row_count, " rows / ", variables_used, " variables")
358+
scale_display
357359
),
358360
Description = c(
359-
"Number of rows used after removing missing values.",
361+
"Number of rows used in the analysis.",
360362
"Number and rate of rows removed because of missing values.",
361363
"Number of variables used in the analysis.",
362-
"Variables dropped before analysis because they had only NA or a single value.",
363-
"Whether variables were scaled to unit variance before analysis.",
364-
"Ratio of the largest to the smallest variable standard deviation.",
365-
"Number of rows compared with the number of variables."
364+
"Variables dropped before analysis because they were all missing or had only one unique value.",
365+
"Whether variables were standardized before analysis.",
366+
"Ratio of the maximum to the minimum standard deviation across all variables."
366367
),
367368
status = c(
368-
"ok",
369+
if (d$analyzed_row_count <= variables_used) "few_rows" else "ok",
369370
if (d$excluded_row_rate >= cfg$na_exclusion_warning) "high_na_exclusion" else "ok",
370371
"ok",
371372
if (length(excluded_names) == 0) "na" else "ok",
372373
"ok",
373-
scale_status,
374-
if (d$analyzed_row_count <= variables_used) "few_rows" else "ok"
374+
scale_status
375375
)
376376
)
377377
}

tests/testthat/test_prcomp.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,16 @@ test_that("new report tidy types return expected columns and tokens", {
9393
model_df <- mtcars %>% do_prcomp(mpg, cyl, disp, hp, drat, wt)
9494
res <- model_df %>% tidy_rowwise(model, type = "analysis_conditions")
9595
expect_equal(colnames(res), c("Metric", "Value", "Description", "status"))
96-
expect_true(all(c("Rows Used","Variables Used","Normalization","SD Ratio (Max/Min)") %in% res$Metric))
96+
expect_true(all(c("Row Count","Number of Variables","Normalization","SD Ratio (Max/Min)") %in% res$Metric))
97+
expect_false("Rows vs Variables" %in% res$Metric)
98+
expect_false("Rows Used" %in% res$Metric)
99+
expect_false("Variables Used" %in% res$Metric)
100+
expect_false("Number of Rows" %in% res$Metric)
101+
# #37268: empty excluded-variables cell is "None" (JA: なし), not "-".
102+
excluded_row <- res[res$Metric == "Excluded Variables", , drop = FALSE]
103+
if (nrow(excluded_row) == 1 && identical(excluded_row$status, "na")) {
104+
expect_equal(excluded_row$Value, "None")
105+
}
97106
res <- model_df %>% tidy_rowwise(model, type = "parallel_screeplot")
98107
expect_equal(colnames(res), c("Component", "Eigenvalue", "Random Data Eigenvalue"))
99108
res <- model_df %>% tidy_rowwise(model, type = "variances_judged")

0 commit comments

Comments
 (0)