I have a dataset containing a weight column, which I would like to subset while adjusting these weights to keep it representative of the original dataset.
Let us say I have the dataframe :
data.frame(Age=c(10,20,30,25,50,60,40),
Country=c("Germany","Germany","Germany","China","China","China","China"),
Class=c("A", "B", NA, NA, "B", "A", "A"),
Weight=c(1.1, 0.8, 1.2, 1.7, 0.7, 1.3, 0.9))
I would like to remove NA
rows in the column Class
, and update the Weight
column to keep my sample representative of the original dataset given the columns Age
and Country
. (The above dataframe may be too small for such question, but this is just for illustration).