Inside %=>% (arrow function), as.character() is declared outside of if statment.