Run several likely-to-crash R scripts [closed] - r

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have several scripts that are likely to crash. Is there a way to run these R scripts (perhaps from a different R script), in a way such that if one if them crashes, it doesn't pull down the others?
These are independent R scripts, running on Windows. By crashing I mean that when I try to run them in the R Gui, after some while Windows tells me R GUI stopped responding: Close program / Find solution.

Catch errors using tryCatch(), and stop execution using stop().
You can do these within a single script by wrapping them within a function, or you can source() scripts within scripts. This decision should really be dictated by your problem's logical structure and your programming practice, not by how errors are caught.

Related

Prevent the command line window from closing when an R script encounters an error [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
The community is reviewing whether to reopen this question as of 1 year ago.
Improve this question
I have an R script which runs on Windows 10. It works on my computer, but not my colleague's computer. I also cannot access my colleague's computer, though I can see the screen (for WFH reasons). For diagnostic purposes, I want to make it so that the command line window does not close when R encounters an error or the script otherwise completes/stops running. How do I do this?
Follow-up: This was using Rscript.exe to run the script. Running it through RGui was what I did eventually - I briefly forgot RGui existed.
Regarding the original question, going into the command line first and running the script from there also worked. Thank you.
You could previously open the command line and call your script from there (instead of executing it by double click).
Or call the script from a batch (.BAT) file with PAUSE as the last line.

R machine learning model deployment as webservice [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Is there any way to deploy machine Learning model written in R language as a webservice, I know we have Flask in python and many more too, but didnt come across for any such library for R Machine learning code.
As others suggested, you can use R-Shiny to build an app which you can later deploy as a web service easily. Moreover, you can use html code inside shiny so you can customise your layout to your heart's content. If you are using RStudio (which I definitely encourage if you don't), you only need to select File > New File > Shiny Web App... Have a look at documentation and examples here.
However, if you only want to create a compact and fast web service without having to build a layout etc, I would suggest you use R plumber library. This is a good solution if you don't need anything too fancy and also is easily implementable by adding decorators to your current code.
Hope this helps!

Is it possible to run a R script using a web server? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Is it possible to run a R script using a web server, similar to Perl CGI?
Yes and you can even run Rstudio remotely on a webpage.
If you want to just run a R script, you have several options:
you can simply ssh your computer that have R
find an online solution (here is the list from CRAN).
build your own server with Rook
depending what you want to do a shiny app could help as well
You have other solutions such as rApache if you didn't like other soltutions

How does Unix Command interpreted at OS level [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am new to Unix and wanted to understand under the hood working of Unix command. My question is whenever we type any command in shell, how are they interpreted at OS level.
Any help will be great. Thanks.
Actually, the interpretation of commands is done by the shell, not the operating system.
As mentioned in a comment, the operating system provides system calls like fork() and execve() that allow the creation and manipulation of processes. There are also calls that control file descriptors so that inputs and output can be arbitrarily mapped. The operating system provides all of this functionality, but it is up to the shell (bash, csh, zsh, etc) to interpret commands and issue the correct system calls.

r - Revolution R - Is modification of my original R-scripts needed? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I learnt from the web that Revolution R allows multi-threading and optimize running of my R-scripts.
My question is: after installation of Revolution R, if I run my R-script under Revolution R environment, will it automatically optimize running of my R-script? Or I need to modify my R-script in order to allow Revolution R to optimize running of my R-script?
Thanks a lot.
I think your terminology may need some refinement. You may need to distinguish multi-processing from multi-threading. Revolution R does link to a multithreaded BLAS library for Windows that might otherwise not be available unless you compiled your version. Whether or not that will improve your performance is apparently somewhat dependent on what functions you use.
To use multi-processing in R, you will need set up your machine resources appropriately and then use code that distributes the parallizable tasks. Those seem to be the applications you are thinking about when you ask about modifying your scripts. Revo-R used to have advantages here over regular R, but for the last couple of versions, the 'parallel' package has been available to all useRs.
Revo R has multithreaded BLAS, this does not require a change in your scripts.
And GNU R, or Standard R, can of course also use multithreaded BLAS as detailed in Appendix A.3.1 of the R Installation and Administration manual.

Resources