An R framework for quality control