In RStudio, can commands be sent from code chunks to the terminal? - r

In RStudio, is it possible to have a code chunk that sends commands to the terminal (specifically Windows CMD prompt)? I know that I can use the command prompt via the "Terminal" tab in RStudio, but I would like to write these commands in a code chunk within a larger RMarkdown document. This way, when I click "Run All", the commands are sent automatically at the appropriate time.

Related

Every time when I start R or want to compile a PDF via knitr I get the following message

The message pops up every time I open R and I still can run code, but it won't let me compile PDFs via knitr. What causes this message and how can I get rid of it? I run R on a Mac btw.

How to execute an R shiny script from the command line

I've created a single R file 'myfile.R' which is composed of several functions, reading from an odbc connection, and of course the ui and server components for the shiny application. The goal is for the user to treat this as an executable, that is, I'd like them to be able to run this app without having to run Rstudio. Currently on this environment, Rstudio is installed (as are the relevant packages), what I'm currently writing in command line is:
Rscript myfile.R
The file looks to be successfully loaded, but the application itself does not 'pop up' towards me, infact nothing does, it just says that it is listening on http....
I was thinking of creating a bash script that could do this, and this seemed to be the most simple approach but this is not working.

R - How to display progress when executing scripts via Command Prompt

I've been using the command prompt to schedule and execute R scripts. However, the prompt always displays an empty screen when executing scripts. Is it possible to display text of the script running?

How do I generate a script for SQLite in Windows 10

These are instructions to generating a script in Linux
"You should start a script by issuing the command
script a2-script
This will create a file a2-script, which will log input and output at the terminal until you stop the script by typing
exit"
How do I do the same thing in windows 10? I tried typing sciprt a2-script in command promt but I get a message saying that the word script is not a recognizable command
The script command records everything you type and everything that is output on your Terminal. You can't do that in Windows easily.
The best thing to do is ignore that step and run the rest of the instructions and, when the screen is full, right-click in the window's title bar and choose edit->mark and select the text you want, then right-click in the title bar again and click edit->copy. Now you have a copy of the window and you can go in a MS-Word document, or any text editor and paste the contents to have a record of what you did.

How to make Rscript stay open until gWidgets gui is closed

I have a script which launches various gWidgets windows with buttons that have functions attached. I'd like to be able to launch this with rscript.exe so others can use it without seeing R. My problem is that when I launch the script using rscript.exe myscript.r an rscript instance shows up in task manager, it loads all the packages, the widget pops up for a second, and then it's gone (including the rscript process from task manager) before the user can even do anything. How can I make the instance of rscript stay active until all the gWidgets windows are closed? If I launch the script from either Rstudio or Rgui it stays open until done. As a similar question, is there also a way to prevent the dialog box showing the various commands from coming up too? I'm using Windows 7 by the way.

Resources