Exporting data from R after getting results