added a function decimate.with.na