The preceding ifelse() function returns the imputed mean value if its first argument is NA. Otherwise, it returns the first argument.