adding r code files, replacing ratematrix.R