row imputations using selected columns using rowMeans(Picture)
i want to impute 4 th column to 8th column without disturbing the remaining columns.
How do i achieve this using rowMeans functionality in R
Thanks in advance.
you can find the image by clicking on picture.
Perhaps we can use
library(zoo) df1[4:8] <- lapply(df1[4:8], na.aggregate)
If we need it based on rows, use
MARGIN = 1
df1[4:8] <- t(apply(df1[4:8], 1, na.aggregate))