Defne and check define variable in R
To define a variable, the assignment symbol “<-“ can be used:
Example:
In the above equation following way we can define variable in R
> a <-1
> b <-1
> c <--1
Following two way we can check any variable:
> a
[1] 1
> print(a)
[1] 1
If we want to check all the define variable, then with the following command we can check it:
> ls()
[1] "a" "b" "c"
Now we have defined the variable, in the following way we can get
> x<-(-b + sqrt(b^2 - 4*a*c))/(2*a)
> x
[1] 0.618034
> x<-(-b - sqrt(b^2 - 4*a*c))/(2*a)
> x
[1] -1.618034