Full R Script