rewrite passages of R file