Skip to content

Commit b9fd1ff

Browse files
Copilotrempsyc
andauthored
Hotfix: replace datawizard::data_tabulate() to avoid r-devel NA row name error in report_participants() (#603)
* Initial plan * Fix CRAN failure: replace datawizard::data_tabulate() with table() to avoid NA row names in r-devel Agent-Logs-Url: https://github.com/easystats/report/sessions/aadc7586-e780-4972-8f93-af5a77524513 Co-authored-by: rempsyc <13123390+rempsyc@users.noreply.github.com> * document --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rempsyc <13123390+rempsyc@users.noreply.github.com>
1 parent 772ee86 commit b9fd1ff

7 files changed

Lines changed: 22 additions & 15 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: report
22
Type: Package
33
Title: Automated Reporting of Results and Statistical Models
4-
Version: 0.6.3.1
4+
Version: 0.6.3.2
55
Authors@R:
66
c(person(given = "Dominique",
77
family = "Makowski",
@@ -91,7 +91,6 @@ VignetteBuilder:
9191
knitr
9292
Encoding: UTF-8
9393
Language: en-US
94-
RoxygenNote: 7.3.3
9594
Config/testthat/edition: 3
9695
Config/Needs/website:
9796
rstudio/bslib,
@@ -161,3 +160,4 @@ Collate:
161160
'utils_misspelled_variables.R'
162161
'zzz.R'
163162
Roxygen: list(markdown = TRUE)
163+
Config/roxygen2/version: 8.0.0

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Bug fixes
44

5+
* `report_participants()`: fix CRAN failure on r-devel due to `row names contain missing values` error by replacing `datawizard::data_tabulate()` with a direct `table()` call for country and race frequency tables (#593).
6+
57
* Fix `report()` crash when character vector has only one unique value (#578).
68

79
# report 0.6.3

R/report.character.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ report_parameters.character <- function(
107107
}
108108

109109
n_entries_actual <- min(n_entries, length(param_text))
110-
as.report_parameters(param_text, summary = param_text[1:n_entries_actual], ...)
110+
as.report_parameters(
111+
param_text,
112+
summary = param_text[1:n_entries_actual],
113+
...
114+
)
111115
}
112116

113117

R/report_participants.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -560,12 +560,12 @@ report_participants <- function(
560560
} else {
561561
data[[country]] <- as.character(data[[country]])
562562
data[which(data[[country]] %in% c(NA, "NA")), country] <- "missing"
563-
frequency_table <- as.data.frame(
564-
datawizard::data_tabulate(data[[country]]),
563+
freq_tbl <- table(data[[country]])
564+
frequency_table <- data.frame(
565+
Value = names(freq_tbl),
566+
Percent = as.numeric(freq_tbl) / nrow(data) * 100,
565567
stringsAsFactors = FALSE
566-
)[c(2, 4)]
567-
names(frequency_table)[2] <- "Percent"
568-
frequency_table <- frequency_table[-which(is.na(frequency_table$Value)), ]
568+
)
569569
frequency_table <- frequency_table[order(-frequency_table$Percent), ]
570570
upper <- frequency_table[which(frequency_table$Percent >= threshold), ]
571571
lower <- frequency_table[which(frequency_table$Percent < threshold), ]
@@ -594,12 +594,12 @@ report_participants <- function(
594594
} else {
595595
data[[race]] <- as.character(data[[race]])
596596
data[which(data[[race]] %in% c(NA, "NA")), race] <- "missing"
597-
frequency_table <- as.data.frame(
598-
datawizard::data_tabulate(data[[race]]),
597+
freq_tbl <- table(data[[race]])
598+
frequency_table <- data.frame(
599+
Value = names(freq_tbl),
600+
Percent = as.numeric(freq_tbl) / nrow(data) * 100,
599601
stringsAsFactors = FALSE
600-
)[c(2, 4)]
601-
names(frequency_table)[2] <- "Percent"
602-
frequency_table <- frequency_table[-which(is.na(frequency_table$Value)), ]
602+
)
603603
frequency_table <- frequency_table[order(-frequency_table$Percent), ]
604604
upper <- frequency_table[which(frequency_table$Percent >= threshold), ]
605605
lower <- frequency_table[which(frequency_table$Percent < threshold), ]

man/reexports.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/report-package.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/report.compare.loo.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)