From 5fef4345ad748f2d0beff1dece43e212605f81b7 Mon Sep 17 00:00:00 2001 From: "Andrei S. Morgan" Date: Fri, 6 Feb 2026 20:21:32 +0000 Subject: [PATCH] Changed disclosure checks to include NAs for cross-tabulations. --- R/tableDS.R | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/R/tableDS.R b/R/tableDS.R index c190ffc3..4bcfd836 100644 --- a/R/tableDS.R +++ b/R/tableDS.R @@ -135,9 +135,10 @@ exclude<-NULL if(!is.null(rvar)&&!is.null(cvar)&&!is.null(stvar)) { -#Check cell counts valid without NAs or NaNs +##Check cell counts valid without NaNs. Note: NAs need to be included as +##otherwise there's a disclosure risk when cross-tabulating. counts.valid<-TRUE -test.outobj<-table(rvar,cvar,stvar,exclude="NaN",useNA="no") +test.outobj<-table(rvar,cvar,stvar,exclude="NaN",useNA="yes") numcells<-length(test.outobj) @@ -161,9 +162,10 @@ numcells<-length(test.outobj) if(!is.null(rvar)&&!is.null(cvar)&&is.null(stvar)) { -#Check cell counts valid without NAs or NaNs +##Check cell counts valid without NaNs. Note: NAs need to be included as +##otherwise there's a disclosure risk when cross-tabulating. counts.valid<-TRUE -test.outobj<-table(rvar,cvar,exclude="NaN",useNA="no") +test.outobj<-table(rvar,cvar,exclude="NaN",useNA="yes") numcells<-length(test.outobj)