November 2017
Beginner to intermediate
204 pages
5h 23m
English
A good guess for the missing values is the mean value of the non-NA values in the same row (in a particular region), since the total length of road doesn't change all that much year to year.
In the following continuation of r_intro.R, the row means in indices corresponding to NA values in 2011 are extracted from the roads.means3 vector. The extracted row means are then assigned to the indices of the roads.2011.3 vector which correspond to NA values:
roads.2011.3 <- roads3$X2011roads.2011.3[is.na(roads.2011.3)] <- roads.means3[is.na(roads.2011.3)]print(sum(roads.2011.3))
This results in a much better estimate of the total roads length as of 2011. It is possible to go even further however to get a similar estimate ...
Read now
Unlock full access