Maybe this question has already been solved, however after having looked around I just found solutions to my problem in other frameworks but not in R. If this is available, please send me the link an will be fine.
My problem is the following: I have a vector with several blank cells that I want to be filled by the previous non-blank one.
So given this data:
Country
Argentina
NA
NA
Costa Rica
NA
Ecuador
NA
I want my output to look like this
Country
Argentina
Argentina
Argentina
Costa Rica
Costa Rica
Ecuador
Ecuador
How can I do this?
Thank you so much in advance.