 ## Introduction to Basics of R: Getting Started in R and RStudio

Basically, R and Rstudio are the same software, however RStudio is an Integrated Development Environment (IDE) wherein you can run, edit

commands and see the results simaltanouesly. Therefore whatever commands that you run in Base R and RStudio will give the same results. Quickly

run some mathematical operations in Base R and move to RStudio

#Let us run command

`print("Welcome to R!")`

## print() is a function. it tells computer to do something

## “Welcome to R!” is an argument

the information function needs to run to give output

`# Perform basic mathematical operation`
`Add`
`12+6`
`substract`
`12-6`
`#multiplying 12 by 6`
`12*6`
`#divide 12 by 6`
`12/6`

`# In Similar fashion you can do all the mathematical calculations.`

### Variable defination in R

`# Variable defination in R # We are assigning value 3 to variable x and value 5 to variable y. Print the value of x and y`
`x <- 3`
`y <- 5`

`x`

`y`

`z <- x + y`
`z`
`n <- z`

`# assigning value to my_var`
`my_var <- 42`
`my_var`
`my_banana <- 6`
`my_banana`
`my_apple <- 5`
`my_apple`
`my_chikoo <- 5`
`my_chikoo`
`my_pin <- 3`
`my_pin`

`# adding fruits`
`my_basket <- my_banana + my_apple + my_chikoo + my_pin`
`my_basket`
`avg_fruit <- (my_banana + my_apple + my_chikoo + my_pin)/4`
`avg_fruit`

### Basic data types in R

`## Numerics ## Character Text ## Boolean values`

`## Class of the data`
`> x <- 5.5`
`> x`
` 5.5`
`> y <- 5`
`>`
`> z<- 3 + 2i`
`> z`
` 3+2i`
`> ## # The quotation marks indicate that the variable is of type character`
`> my_character <- " universe"`
`> my_character`
` " universe"`
`> class(x)`
` "numeric"`
`> class(y)`
` "numeric"`
`> class(z)`
` "complex"`
`> class( my_character)`
` "character"`
`>`
`> my_character <- "1"`
`> my_logical <- TRUE`
`> my_logical <- FALSE`
`> ## What is the class of this variable?`
`>`
`> my_character42 <- "forty-two"`
`> class(my_character42)`
` "character"`