Saturday 13 June 2015

R : Logical data type

Logical variable represent false/true.

> a=1; b=2
> a>b
[1] FALSE
> 
> c=a>b
> 
> c
[1] FALSE
> 
> class(c)
[1] "logical"


Following are the logical Boolean operations
         & (and)
         | (or)
         ! (negation)

> var1=FALSE; var2=TRUE
> 
> var3= var1 & var2
> var3
[1] FALSE
> 
> var4 = var1 | var2
> var4
[1] TRUE
> 
> var5 = !var4
> var5
[1] FALSE
>



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment