i m a beginner in R and i\'m spending hours and hours trying to debug a function with IFELSE statement. I know it could be kind of obvious but i can\'t find a solution. Here