Summary
28. Exercise 3

Instruction

Excellent!

Exercise

As you can tell, the built and last_renovation columns are not populated for several observations. Let's assume that such houses are very old. Replace all NAs in built with the oldest year that is stored under the built column. Then, replace all NA values in the last_renovation with the values stored under the built column.

Stuck? Here's a hint!

Find the oldest house with the min() function - set the optional na.rm argument to TRUE in order to omit NAs. Assign that min value to the built column for rows where is.na(houses$built) is equal to TRUE.

For the last_renovation column you need to find rows where is.na(houses$last_renovation) is equal to TRUE and then assign corresponding values from the built column.