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.
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.
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.