sdcTools / UserSupport

The place to be for User Support on SDC tools and to download the latest releases
https://sdctools.github.io/UserSupport/
Other
11 stars 4 forks source link

Establish k-anonymity button still disappears in current version #114

Closed santalw closed 5 years ago

santalw commented 5 years ago

SDC tool used: sdcMicro, using the UI from command sdcApp()

Version used: the latest version of shiny and sdcMicro (just updated using update.packages(ask=FALSE)) on May 1, 2019

Operating system used: Mac, with Chrome browser, GUI launched from R 3.5.1 and R studio 1.1.463

Issue:

The Establish K-anonymity button is available when both "setting importance" and "apply on subset key variable" are chosen as No. However, once I click yes for any of the two advance options, the button disappears. The button will reappear once I change "yes" to "no" for both options, but this is limiting the functionalities of the GUI.

There was an similar issue reported here and the issue had been closed on Jan 2018: #83

Please advice how can I set up importance vector using the GUI. Thanks!

bernhard-da commented 5 years ago

@santalw thx for reporting, however, i can't reproduce.

once you specify apply on subset key variable, you need to enable Apply k-anonymity to all subsets ofnkey variables? for at least one subgroup. only in this case the button will appear.

apart from that, i think everything works as expected. could you please paste the output of the reproducibility tab (the R-code) here just before you play around in the k-anonymity tab? thx.

santalw commented 5 years ago

Thanks for your prompt reply! I am able to reproduce the case you described for applying on subsets of key variable, but I still cannot get the button back when I just want to modify importance.

Here is a screenshot of the GUI once modify importance is selected as Yes, and the importance is ranked for every key variables. Kanonymity

Here is the code generated prior to this step:

require(sdcMicro) inputdata <- readMicrodata(path="mypath/exportedData_HHsubset.rdata", type="R", convertCharToFac=TRUE, drop_all_missings=TRUE) inputdataB <- inputdata Set up sdcMicro object sdcObj <- createSdcObj(dat=inputdata, keyVars=c("REGION","URBRUR","HHSIZE","RELIG","OWNAGLAND"), numVars=c("LANDSIZEHA","INCRMT","INCWAGE","INCFARMBSN","INCNFARMBSN","INCRENT","INCFIN","INCPENSN","INCOTHER","INCTOTGROSSHH","THOUSEXP","TFOODEXP","TALCHEXP","TCLTHEXP","TFURNEXP","THLTHEXP","TTRANSEXP","TCOMMEXP","TRECEXP","TEDUEXP","TRESTHOTEXP","TMISCEXP","TANHHEXP"), weightVar=c("WGTPOP"), hhId=c("IDH"), strataVar=NULL, pramVars=c("ROOF","TOILET","ELECTCON","FUELCOOK","WATER","OWNMOTORCYCLE","CAR","TV","LIVESTOCK"), excludeVars=NULL, seed=0, randomizeRecords=FALSE, alpha=c(1)) Store name of uploaded file opts <- get.sdcMicroObj(sdcObj, type="options") opts$filename <- "exportedData_HHsubset.rdata" sdcObj <- set.sdcMicroObj(sdcObj, type="options", input=list(opts)) ` more background: I am learning how to apply disclosure control using the GUI by following the case studies in Statistical Disclosure Control: A Practice Guide. The variables show up above are all from the dataset provided by the case studies. Currently I am at step8a where importance vector need to be set up before establishing 2-anonymity for the household level data subset.

Thanks again!

bernhard-da commented 5 years ago

hi @santalw

thx for the report. unfortunately, i can't reproduce with the testdata (could you share the exportedData_HHsubset.rdata file?). do you see any errors in the R console?

can you also post the output of devtools::sesssion_info()

thx.

santalw commented 5 years ago

Thanks for your responding! Yes, there are error messages in the console:

> sdcApp()
Listening on http://127.0.0.1:5312
Warning: Error in if: argument is of length zero
  97: renderUI [controllers/ui_categorical.R#439]
  96: func
  83: origRenderFunc
  82: output$kanon_btn
   2: runApp
   1: sdcApp
Warning in `<reactive:kAnon_impvec>`(...) : NAs introduced by coercion

The warning messages before the last line is generated when I click k-Anonymity in the left bar of Anonymize. The last line of warning is generated when I click on "Yes" for "do you want to modify importance of key variables for the suppression?"

Here is the output for session info:

> devtools::session_info()
- Session info -------
 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 os       Windows 7 x64 SP 1          
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_Canada.1252         
 ctype    English_Canada.1252         
 tz       America/New_York            
 date     2019-05-03       

- packages --------------- (for confidentiality reason I only copied several relevant ones. Please let me know if you would like to see the full list. Thank you!)
sdcMicro      * 5.3.0   2018-05-16 [3] CRAN (R 3.5.3)
shiny         * 1.3.2   2019-04-22 [3] CRAN (R 3.5.3)
shinyBS       * 0.61    2015-03-31 [3] CRAN (R 3.5.3)

Thanks!

bernhard-da commented 5 years ago

hi @santalw

I think I know why I was not able to reproduce. On the computer I tested I had the latest version from github installed where this issue was already fixed. So it would be great if you could test with:

# install latest version from github
remotes::install_github("sdcTools/sdcMicro")

# run tests

and confirm that everything is working. we are in the process of uploading a new version of sdcMicro soon. if everything is ok, you can remove this devel-version using remove.packages("sdcMicro) again and update with update.packages() once the new version hits CRAN.

santalw commented 5 years ago

Thanks @bernhard-da ! There is no problem in the new version. Could you give us an estimated time for the next release? We look forward to the new version. Good luck to your team:)

alexkowa commented 5 years ago

New version on CRAN from 2019-05-16

Freeedim commented 3 years ago

Hi there! I am now experiencing the very same issue with sdcMicro 5.5.1. Possible regression?

bernhard-da commented 3 years ago

hi @Freeedim thx, can you please provide the example (data) and code that you used? thx.