explain grep and ifelse