I've got a lengthy process running in Rstudio and I would like to open a separate session of Rstudio while the first one is running. I know I can run R from the command line to get as many sessions as I want, but I wanted to know if it is possible for me to do this in Rstudio on a Linux computer. Thanks.
#infominer suggested a good solution, which is to simply type rstudio in the command line. That's what I ended up doing
Another convenient way to deal with this is to start a seperate R-instance in the terminal by typing simply
R
and from there just run the script that has a lengthy process with
source("path-to-your-script/your-script.R")
you can than continue to edit and work with your two scripts in the already opened R-Studio editor window.
Related
I am a professor at a small college, and I am working with a blind student in a statistics course. We have found that R is by far the most accessible system to use, and for the screen reader to work (i.e. for it to read the output), we need to run R out of the Command Prompt (the student uses a Windows machine, specifically one running Windows 7). Though using the R console would probably be easier to operate, for some reason the screen reader being used by the student (JAWS) doesn't read the output in the console.
We have gotten to the point where we can use R out of the Command Prompt just fine, but the issue is that we cannot save the command history and the output from the Command Prompt to an external file (e.g. a .txt). I understand that I can use the sink() function to get the output in a .txt file, and I can also use the savehistory() function to get the command history, but I need something that captures both. We have also tried to use CMD outside of the R environment to try and print the full session of the Command Prompt, but that doesn't seem to capture the work that we might do during an R session.
On a Mac, this wouldn't be a problem, but I am not the best with using the Windows Command Prompt.
Any help would be greatly appreciated, and if more detail is required, I am more than happy to provide it.
I have a script in R that is frequently called during the day (by other scripts). I call R in a terminal using
Rscript code.R
I notice it takes a lot of time to load packages and set up R.
Is it possible to run R as a background service which I hit using a port or something?
Yes, look into RServe which has been available for over a dozen years for this reason. There are a couple of fairly high profile applications too.
You can check out this add-in for Rstudio, it is not a port like solution but maybe it can help you https://github.com/bnosac/taskscheduleR
I'm running Rstudio server and wondering if there is a way to run a command that may take a bit of time to complete and at the same time visually explore some of my environment's dataframes.
When I click on a dataframe it issues the view() command but if R is busy, it will not let me view the dataframe until the last command finishes. Is there a way to run the view command in parallel?
No.
The other thing you might be able is if you have the Pro version generate a parallel session
I usually open the R console all day long, but sometimes I need to clean my history and my workspace's background so that I can test functions or load new data.
I'm wondering whether there is an easier way to use a command line in .Rprofile so that I can refresh the R console without quitting or rebooting my current session.
What I have usually done for this is to q() without saving and then start R again and clean the History. I think somebody here might be able to give me some better suggestions.
Thanks in advance.
For what concerns history, in UNIX-like systems (mine is Debian) this command refreshes it
loadhistory("")
However, as said in comments, loadhistory seems to be platform-dependent.
Check your ?loadhistory if present on your platform. Mine says:
There are several history mechanisms available for the different
R consoles, which work in similar but not identical ways. There
are separate versions of this help file for Unix and Windows.
The functions described here work on Unix-alikes under the
readline command-line interface but may not otherwise (for
example, in batch use or in an embedded application)
I've found a lot of answers on how to run R from a Batch file, but nothing about running a Batch File from R. I know one way to do this is to use system, system2 or shell, but these methods wait for process in the Windows Command Prompt to finish before R accepts another input. I want to run a Batch File which calls a console application that runs indefinitely, and then allow R to do other things. Any help would be greatly appreciated.
The help page ?shell says how to do it. Just run
shell("MyScript.bat", wait=FALSE)