Skip to content

Commit 418b157

Browse files
committed
fix/feat: Updating github + github.io to latest development version
1 parent 6e30af7 commit 418b157

File tree

11 files changed

+59
-31
lines changed

11 files changed

+59
-31
lines changed

NEWS.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
from one or multiple XLSX files written by `annex_write_stats()` (beta).
1717
* Removing ventilation type 'Exhaust air' added in 0.2-8
1818
* `annex_stats()` will return `NA`s for 'Mean' and 'Sd' in case the number of
19-
valid observations (`N - NAs`) are less than 30. `annex_validate()` will
20-
test that.
21-
* `annes_validate()` now also throws an error if `Sd < 0` (see condition above).
19+
valid observations (`N - NAs`) are less than 30.
20+
* `annex_stats()` will return `NA`s for `interval_*` if `N - NAs == 1` (we have
21+
exactely one valid observation).
22+
* `annex_validate()` validates for the two conditions above.
23+
* `annex_validate()` now also throws an error if `Sd < 0` (see condition above).
24+
* Series of additional tests added.
2225

2326
# annex 0.2-8
2427

R/stats.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,7 @@ annex_stats <- function(object, format = "wide", ..., probs = NULL) {
346346
# cells in the final xlsx file (`annex_write_stats()`)
347347
idx <- which(res$N - res$NAs < annex:::minsamplesize)
348348
if (length(idx) > 0) {
349-
cols <- names(res)[grepl("^(Mean|Sd)$", names(res))]
350-
res[idx, cols] <- NA
349+
res[idx, c("Mean", "Sd")] <- NA
351350
}
352351

353352
# Reshape to long format if required

R/validate.R

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,29 @@ annex_validate_sheet_STAT <- function(file, user, quiet, ...) {
157157
# Checking user
158158
if (nrow(data) == 0) stop(red $ bold("No data in sheet 'STAT'"))
159159

160+
# NAs > N
161+
idx <- data$N <= data$NAs
162+
if (any(idx)) {
163+
stop(red $ bold("Found ", sum(idx), " rows where N <= NAs (all or more than all missing)",
164+
" in sheet 'STAT',\n", get_row_info(idx), sep = ""))
165+
}
166+
160167
# Missing values
161168
for (col in required_cols) {
162-
if (grepl("^(Nestim|N|NAs)$", col)) {
163-
idx <- is.na(data[[col]] | data[[col]] < 0)
169+
if (grepl("^(N|NAs)$", col)) {
170+
tau <- if (col == "N") 1 else 0
171+
idx <- is.na(data[[col]] | data[[col]] < tau)
164172
if (any(idx))
165-
stop(red $ bold("Found ", sum(idx), " missing or negative values ",
166-
"(empty cells) in column '", col,
173+
stop(red $ bold("Found ", sum(idx), " missing values (empty cells) or ",
174+
"values <", tau, "in column '", col,
175+
"' in sheet 'STAT',\n", get_row_info(idx), sep = ""))
176+
# If interval-based columns (interval_* and Nestim): must be NA if
177+
# N - NAs == 1, else must be filled and positive.
178+
} else if (grepl("^(interval_.*|Nestim)$", col)) {
179+
idx <- (data$N - data$NAs == 1 & !is.na(data[[col]]))
180+
if (any(idx))
181+
stop(red $ bold("Found ", sum(idx), " non-missing values ",
182+
"in column where `N-NAs == 1` '", col,
167183
"' in sheet 'STAT',\n", get_row_info(idx), sep = ""))
168184
} else {
169185
idx <- is.na(data[[col]])

docs/articles/lookupfunctions.html

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

docs/articles/write_and_validate.html

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

docs/news/index.html

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

docs/pkgdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ articles:
1212
unitconversion: unitconversion.html
1313
visualization: visualization.html
1414
write_and_validate: write_and_validate.html
15-
last_built: 2023-12-17T19:02Z
15+
last_built: 2023-12-22T06:11Z
1616
urls:
1717
reference: https://some.example-url.com/reference
1818
article: https://some.example-url.com/articles

docs/reference/annex.html

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

docs/reference/annex_stats.html

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

docs/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

man/annex_stats.Rd

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

0 commit comments

Comments
 (0)