data.table ifelse type mismatch error

@Peter_Griffin It is discouraged to @name reference a user who has not engaged in a thread on their own. Please see the community faq about @name usage