preparing R file