Replace NA values with values from unknown distribution

Hi,
I have data with missing values.
I want to replace them with sampled numbers from the unknown distribution of the vector.

"Sample" command is the way to do so?

That is correct. If you don't want to resample NAs, then make sure to pull out all NAs beforehand by calling vec_without_nas <- vec[!is.na(vec)], and resample with replacement.

What context are you doing this in, if I may ask?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.