This is the second lesson of CloudStat School, Lesson 2: Values & Variables.

At the end of the lesson 2, you should know:

1. Inserting values into valuables

2. Calling valuables

3. Simple operation within variables.

**2.1 Assign/Insert Values into Variables**

There are 2 symbols can be used:

i) less than minus, <-

abc <- 123

ii) equal, =

xyz = 321

By typing these commands, you are assigning the

value of 123 into variable abc. Same as 321 into xyz.

**2.2 Calling Values from Variables.**

To see the values have been assigned into variables,

we need to call them.

To call values from variables, simply type variables’ names.

In this case (from 2.1):

abc

xyz

Click “Run” button to see the result.

**2.3 Assign & Call Variables**

> abc <- 123

> xyz = 321

> abc

[1] 123

> xyz

[1] 321

You have assigned the values of 123 and 321

into abc and xyz repectively.

**2.4 Simple Mathematic Operation with Variables**

The common math operators are

plus **+**

minus **–**

multiple *****

division **/**

Remain the last commands, type and run:

abc + xyz

xyz – abc

You will see:

> abc + xyz

[1] 444

> xyz – abc

[1] 198

abc + xyz means 123 + 321, so you got 444

xyz – abc means 321 – 123, you got 198

That’s just for warm-up!

But hope you had learnt about:

1. Inserting values into valuables

2. Calling valuables

3. Simple operation within variables.

*Related*

To

**leave a comment** for the author, please follow the link and comment on his blog:

** CloudStat**.

R-bloggers.com offers

**daily e-mail updates** about

R news and

tutorials on topics such as: visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...

**Tags:** cloudstat, CloudStat School, R Language, r learning, Values, Variables