bnowok / synthpop

Generating Synthetic Versions of Sensitive Microdata for Statistical Disclosure Control
40 stars 8 forks source link

error with syn on data with labels #19

Open hjvdwijk opened 3 years ago

hjvdwijk commented 3 years ago

Using syn on data with labels causes an error, for example this small dataset below. This error also can occur with other methods for larger data sets.

data <- tibble(id = c(1,2,3), val = c("1","1","0")) val_label(data$val,"0") <- "No" val_label(data$val,"1") <- "Yes" synth <- syn(data, method = "sample")

Error: Can't subset elements that don't exist. x Locations 1, 2, and 3 don't exist. i There are only 0 elements.

bnowok commented 3 years ago

Many thanks for reporting the issue. The bug has been removed in the version 1.7-0 (available on GitHub). Synthetic data do not have labels though. I hope it is not a big problem.