bugfix: guard against data sets with more than one class, cf. #87
only one message for converting to data.table
refactor: extract function