First, I have read (R: replace NA with item from vector) but I need a bit more detail.
Typically this operation is executed in Fox Pro but that is not going to be available soon.
So I have a data set. Below is the code that I have used as of yet.
x<- read_fwf(file="NEW.DATA1", skip=0, fwf_widths(c(2,2,6,4,2,2,2,4,2,1,9,8,9,9,9,9,9,14,8,14,12,1)))
write.csv(x, file= "newdata1a.csv",row.names=FALSE)
The second column intermittently has NA values due to there being nothing in the original text file (newdata1). What I am hoping to accomplish is replacing the NA with a 04 or 07 based on the values of the third column. This may sound rudimentary but the articles that I have found don't seem to match up.