I have a dataset with many NAs. I want to use the number before the NA to replace it. Specifically,
Date Price
1 2.1
2 NA
3 2.4
I want to use '2.1' to replace the NA below it. I'm storing my data in a data.table and it contains 700 million observations. I know how to do it with a forloop, but it's taking a very long time. Is there a way to improve the speed?