Register Login

Run basic code in Rstudio

Updated May 19, 2018

How to run a basic code in R Program?

Please follow the steps below in order to run a basic R program:

1) Click on File > New File > R Script. You can also use the shortcut Ctrl + Shift + N.

2) This will open a new panel named "untitled1". 

3) This panel is used for writing the code.

4) The output of which appears in the panel below named console.

5) To clear the console, Press Ctrl + L.

Basic Math Functions:

6) For example 12 + 8 (remember to give space between numbers and operators).  Type the equation in the Untitled1 panel and click run.

7) The output appears in the console as 20.

8) You can use *, /, +, - for multiplication, division, addition and subtraction respectively. 

9) Whenever you hit "Run", it runs the single line of code that has the cursor. To run multiple lines of code, you can highlight/select the lines and then click on "Run".

10) It will run the selected code.


×