update R QC function