# R Programming: An Introduction

Using the Script Panel To write proper R programming codes, you start with a new script by going to File > New File > R Script, or hit Shift + Ctrl + N..You can then write your codes in the script panel..Select the line(s) to run and press Ctrl + Enter..The output will be shown in the console section beneath..You can also click on little Run button located at the top right corner of this panel..Codes written in script can be saved for later review (File > Save or Ctrl + S)..Basics of R Programming Finally, with all the set-ups, you can write your first piece of R script..The following paragraphs introduce you to the basics of R..A quick tip before going: all lines after the symbol # will be treated as a comment and will not be rendered in the output..Arithmetics Let’s start with some basic arithmetics..You can do some simple calculations with the arithmetic operators: Addition +, subtraction -, multiplication *, division / should be intuitive..# Addition 1 + 1 #[1] 2 # Subtraction 2 – 2 #[1] 0 # Multiplication 3 * 2 #[1] 6 # Division 4 / 2 #[1] 2 The exponentiation operator ^ raises the number to its left to the power of the number to its right: for example 3 ^ 2 is 9.. More details