My data set has columns labelled "City", "Zipcode", "Neighbourhood". I have all the values for Neighbourhood but some values for city and zipcode are missing. How do I match the "Neighbourhood" columns to the given values in "City" and "Zipcode" and use it to fill the missing values of "City" and "Zipcode"?
            Asked
            
        
        
            Active
            
        
            Viewed 44 times
        
    0
            
            
        - 
                    1[See here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on making an R question that folks can help with. That includes a sample of data, all necessary code, and a clear explanation of what you're trying to do and what hasn't worked. – camille Apr 17 '20 at 16:02
1 Answers
0
            
            
        You could make a table with your complete cases, then replace the incomplete rows in your data from this:
complete.data <- unique(na.omit(data.df))
for (i in 1:nrow(data.df)){
  data.df[i,] <- complete.data[complete.data$Neighborhood %in% data.df$Neighborhood[i],]
}
 
    
    
        Obim
        
- 136
- 5
