jeudi 29 juin 2017

giving if condition for time

Is there any way we can give a condition statement in a if else loop as

 a= "06/28/2017 08:45"
 b= "06/28/2017 08:32"
 c= difftime(a,b,units="mins)
`if(a+30 > b)
 { 
  print("you are late")
  }else
  print("on time")`

I'm getting error as

 `1.Error in if (a+30 > b) missing value where TRUE/FALSE needed
  In Ops.factor(a+30 > b) :‘>’ not meaningful for factors
  2: In if (a+30 > b) { : the condition has length > 1 and only the first element will be used`

What I'm trying to do is to add 30min to 'a' and compare it wih 'b' to determine if something is late or on time.

Aucun commentaire:

Enregistrer un commentaire