No matches were found for subject:"\[R\] Odd behavior of a function within apply"