In R, you can use the approx() function to perform linear interpolation. Suppose we have a simple data frame df with missing values:
main.r64 chars2 lines
To use approx() function to get missing values for y column:
main.r457 chars18 lines
This will output the following data frame:
main.r38 chars7 lines
Therefore, the missing data point at x = 3 is filled with interpolated value y = 7.
gistlibby LogSnag