update preprocessing of IMS using R