Skip to content

Commit 300cda5

Browse files
committed
Additional check for colons in labels in createArgusInput()
1 parent daf6775 commit 300cda5

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,4 @@ License: GPL (>= 2)
3636
LazyData: true
3737
SystemRequirements: GLPK library, including -dev or -devel part
3838
Encoding: UTF-8
39-
RoxygenNote: 7.2.3
4039
VignetteBuilder: knitr

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# sdcTable next
22
- Additional check for `createArgusInput()` to make sure that the holding variable is integer (if specified)
3+
- Additional check for colons in labels in `createArgusInput()`
34

45
# sdcTable 0.32.6
56
- Improvements in `SIMPLEHEURISTIC` when adding additional suppressions

R/tauBatch_helpers.R

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ check_suppmethod <- function(method) {
123123
method
124124
}
125125

126+
# no colons in var-labels (https://github.com/sdcTools/UserSupport/issues/301)
127+
check_colon <- function(x) {
128+
for (n in names(x)) {
129+
if (sum(grepl(",", x[[n]]$codes)) > 0) {
130+
stop("Colon (,) detected in a label for dimensional variable ", shQuote(n))
131+
}
132+
}
133+
invisible(TRUE)
134+
}
126135

127136
###############################################################################################################
128137
##### helper-functions that are used to create hierarchy-files for tau-argus using an sdcProblem-instance #####
@@ -218,8 +227,9 @@ create_microdata_and_metadata <- function(obj, verbose, digits=2, path=getwd(),
218227
# define output-matrix (required for fixed-file format)
219228
mat <- matrix("", nrow=nrow(mdat), ncol=1)
220229

221-
# calculate hierarchy-files
230+
# calculate and check hierarchy-files
222231
hiercodes <- hrc(obj)
232+
check_colon(x = hiercodes)
223233

224234
# write microdata
225235
# 1: dim-vars
@@ -352,8 +362,9 @@ create_tabdata_and_metadata <- function(obj, verbose, responsevar, digits=2, pat
352362
# define output-matrix (required for fixed-file format)
353363
mat <- matrix("", nrow=nrow(mdat), ncol=1)
354364

355-
# calculate hierarchiy-files
365+
# calculate and check hierarchy-files
356366
hiercodes <- hrc(obj)
367+
check_colon(x = hiercodes)
357368

358369
# write microdata
359370
# 1: dim-vars

0 commit comments

Comments
 (0)