Site hosted by Angelfire.com: Build your free website today!

Assigning Values to Variables :

> x<-3                                     # [puts x = 3 ]
> x                               # [remember that X is not equal to x in S-plus / R]
[1] 3
> 4->x                                     # [puts x = 4 , just 2nd way of assigning values to variable]
> x
[1] 4
> x_5                           # [puts x = 5 , just 3rd way of assigning values to variable]
> x
[1] 5
> 5_x                           # [ This does not input 5 as a value of x, so you will receive an Error message ]
Error: Left side of assignment can't be of mode numeric
Dumped

> x<-3;y<-4                 # [ Puts values of x and y simultaneously]
>
> x
[1] 3
> y
[1] 4
> assign("x",c(1,2,3))    # [puts x = 1,2,3 , just 4th way of assigning values in x]
NULL
> x
[1] 1 2 3

 

Back to Index page