R script draft & its connection to the GUI