fix R matrices, add r test files