On Sun, Aug 16, 2015 at 3:27 AM, Swagato Chatterjee <swagato1...@gmail.com> wrote:
> Hello, > > I have written a R script which runs a regression of a dataset and saves > the result in a csv file. > > Now this dataset has to be edited periodically which is done in a server. I > need to run the R script in a server so that the results can also be shared > in a server and used in a web application. > > I have coded in R and have used R in windows. I have never used > Ubuntu/Linux. Is there a step by step guide on how to run a R code in > server? > > Thanks and Regards, > > Swagato > > I was going to answer yesterday, but work went insane. Also, I was hoping someone else had something, because I don't have any "step by step" instructions. This is a rather complicated question. So I'm going to ask a number of questions and make some statement for you to correct, if necessary. Statement: You have a Windows desktop and have used R on it, so you are familiar with R in a Windows environment. Statement: You are not Linux (Ubuntu) trained. Statement: You wrote an R script on Windows, which works, but you need to run it on Ubuntu. The above is my starting point. Now I have some questions. Can you connect to the Ubuntu server from your Windows desktop? If so, how? If not, I'm confused about how you could get anything to run on the Ubuntu server. Where does this "dataset" reside? On you desktop? On a Windows shared folder? On the Ubuntu server? Other? Who or what edits the "dataset"? That is, is it always yourself? Some one in your group? Some other human? Some automated process? Why can't you run the R script as you do now, then deploy the results to the Ubuntu server? Since I don't know the environment that the Ubuntu server runs in, I can't address how to deploy an updated file into it. I assume you have some sort of deployment software. It could be as easy as being able to ftp the results from your desktop to the proper places on the Ubuntu server. === Now, whatever the answers are to the above, you'll likely need some help from your Ubuntu server people. My first approach, given my ignorance, would be that I would have something set up so that you could edit this "dataset" on your desktop (assuming that's what you do). I would then have you ftp it to a special directory on the Ubuntu server set up especially for this function. Now, what remains would be running the R script, likely in a "shell script" (like a PowerShell command file), whenever you do the ftp. There is a function in Ubuntu (any Linux) called "icrond". This is a daemon (Windows service equivalent) which can "monitor" a file or directory for changes. When a change is detected it can take an action. In this case it would be to schedule the execution of the previously mentioned "shell script". The "shell script" would then take the actions necessary to do the R script ("R CMD script-name parameters ..." for instance) and then deploy the results to the web server (however you normally do this). Setting up the icrond environment is going to take some work by your Ubuntu administrator. === I hope this was at least the start of some help to you. -- Schrodinger's backup: The condition of any backup is unknown until a restore is attempted. Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be. He's about as useful as a wax frying pan. 10 to the 12th power microphones = 1 Megaphone Maranatha! <>< John McKown [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.