data.frame(
group = c("a", "b", "c", "d", "e", "total"),
count = c(NA, NA, 10, 21, 49, 85)
)
>
group count
1 a NA
2 b NA
3 c 10
4 d 21
5 e 49
6 total 85
Given the above data frame, how can I impute the NA values, so that
- the totals of
a-e
matchtotal
- each imputed NA is <10?
A solution could either be generating a nested data frame of all possibilities, or replace NA
with a distribution or sth... Thanks!