Member-only story

How To Run Terminal / Command Prompt Commands In R!

Manpreet Singh
1 min readJan 15, 2021

--

Running terminal / command prompt commands is something that is super important, and R has built in functionality to actually run whatever scripts you would normally run in terminally natively within R, and it’s extremely easy to do. First off, make sure you have R / RStudio installed on your machine, if you don’t have it, use this article I made to learn how to install it!

Next up, open up a blank R script (or one your already using) and copy and past the following code:

system("PASTE YOUR TERMINAL / COMMAND PROMPT CODE HERE")

Now, all you have to do is replace that code in between the quotes with whatever you would like to run in the terminal / command prompt. Whether thats a Python script, some javascript file, or whatever else you’de like, it will literally run that as if you pasted it in your terminal / command prompt! Enjoy running your terminal / command prompt commands in your R scripts!

--

--

Manpreet Singh
Manpreet Singh

No responses yet