**We will learn:**1. Expression

2. Logical Value

3. Variables

4. Functions

5. Help

6. Files

**Details:**This following lesson is taken from http://tryr.codeschool.com/ . As a beginner, I finally found a place to practice R excellently (which is recommended by RStudio. Thanks, bro - I also recommend you to start your R days in that amazing site.

Here, we will learn some simple things of R commands and execution including, Expression, Logical Values, Variables, Functions, Helps and Files.

**Warning**!

**R is Case Sensitive**!

###
**A. Expression**

__a.1__.

*Simple Math Operation*. When we would like to get result from 1+1, then we don't need equals sign, as follows:

> 1+1

Result: [1] 2

we can do the same with minus [-], multiplying [*] and devision [/]. See this following examples:

**Minus**

> 9 -3

Result: [1] 6

**Multiplying**

> 4*2

Result: [1] 8

**Division**

> 10/2

Result: [1] 5

__a.2.__

*String Value*. R takes string value written with Quotes, as follows:

> "Hi, Everyone!"

Result: [1] "Hi, Everyone!"

###
**B. Logical Value**

Talking about Logical value means talking about TRUE or FALSE. R has it as well as other programming languages do. Let's start!__b.1__.

*To check if a statement is TRUE or FALSE*(

*TRUE*or

*FALSE*written in uppercase. Remember! It's a case sensitive).

**Less than <**

> 6<9

Result: [1] TRUE

**More than >**

> 4>1

Result: [1] TRUE

**Equals**(Use double-equal-sign to do that!)

6+4 == 12

Result: [1] FALSE

**T and F**(TRUE and FALSE shorthand)

F==FALSE

Result: [1] TRUE

###
**C. Variables **(*"I love this stuff in all programming language"*)

As you know that variables are used to store values. That stored values will be accessed later.Let's start!

__c.1.__

**Math Variable**. Here we will use a variable to store and, at last, we will do with simple math operation.

Examples:

> x<-50

> x/2

Result: [1] 25

__c.2.__

**String Variable**. Here, we store string in /z/ and execute it.

Example:

> z<- "Welcome!"

> z

Result: [1] "Welcome!"

__c.3.__

**Logical Value**.

Example:

> x<-FALSE

Result: [1] FALSE

###
**D. Functions**

Time to more complicated :D ... Here's we will do some Math Functions, such as, Sum, Average, etc.Lets' start!

__d.1__.

**Sum**(a comma means '

*Plus*')

> sum(2,5,3)

Result: [1] 10

__d.2.__

**Repeat**a value (we use

**rep**with times=...)

__:__

**Formula****rep**(

*string-value*,times=

*numeric*)

Example:

> rep("Go!",times=4)

Result: [1] "Go!" "Go!" "Go!" "Go!"

__d.3.__

**Square Root**Operation

Example:

> sqrt(16)

Result [1] 4

###
**E. Help**

How to get Help in R ?Lets' start!

__e.1.__For

*global help*, we type:

> help()

__e.2.__For

*specific help*, type the specific word inside the braces, as follows:

> help(c)

Another example:

> help(sum)

__: when you need to know how /sum/ or /c/ works in an example, then you type as follows:__

**Note**> example(sum)

*or*,

> example(c)

*Another example*:

> example (rep)

R then gives you some examples about how to use them

###
**F. Files**

When you have files listed (R Projects) in your directory (R's files has *dot+R*in its extension, e.g.

*myfile.R*), you can list of them by typing

**list.files()**functions, as follows:

> list.files()

Let's say that one of the files listed is: myfile.R. Now, run the files with:

> source("myfile.R")

Warning! do not forget to use quotes inside the braces.

*Well*, that's all for the start since the tutorial I've got stop at that "F" too. :D