I have some missing data like :--
1995 1996 1997 1998 1999
4 NA NA 5 NA
what i want to do here is this :-
1995 1996 1997 1998 1999
4 4.3300001 4.6700001 5 5.0000002
Iam able to write code for the above interpolation (missing and stale data) but........
The data i input is not always clean. It might come as
1995 1996 1997 1998 1999
4.032 NA NA 5.134 5.0000002
This might interrupt with the precision of the interpolated numbers (who go to 7 decimal places)
So i wanted to round off the data before running my interpolation function.
I tried rounding off (doesn't work)
How to round a long decimal place cell in R?
as.numeric increases the precision of character digits?
I tried multiplying with 100, rounding to 0 decimal places and then dividing by 100, (doesn't work) (for some reason every division causes data to go n decimal places)
I also tried using (options = digits) because that works on all digits and not only on digits to the right of the decimal place.
Can anyone help me out here?