changed ts generator to for loop...still crashes R