R plot, working iteration, dynamic penalty, csv output