Replace NA with random weighted value by group
I want to replace the NAs in a variable with a weighted random sample of the values within a given group. Rough sample data: A tibble: 16 × 3 letter number code <chr> <int> <chr> 1 a 1 w1 2 a 1 w1 3 a 1 w2 4 a 1 NA 5 a 2 x1… Read More Replace NA with random weighted value by group