From a large data frame, I have extracted a row of numeric data and saved as a vector. Some of the values are missing and marked as NA. I want to impute the missing values w
Use this:
filter <- is.na(myVec) myVec[filter] <- colMeans(myDF[,filter], na.rm=TRUE)
Where myVec is your vector and myDF is your data.frame.
myVec
myDF