missing values

Replacing missing values in R

Problem So I’m a regular visitor of the r/rstats subreddit and recently there was a post about replacing missing values using a certain logic. Specifically here is the problem: Below is a dataframe where each row represents a city and the idea is to fill the missing unemployment rate. The OP (original poster) wanted to fill in the NA columns based on the mean value of the unemployment rate of the same State and Size.