fisxing up r script