deltime=readline(prompt="Please enter deliery date and time\t") # for input of date and time
#> Please enter deliery date and time
T=as.POSIXlt.character(deltime) # to pass the time in formate R accepts
#> Error in as.POSIXlt.character(deltime): character string is not in a standard unambiguous format
if(Sys.time()+60*30 < T){
f = function(){
a = runif(1500,1,10)
return( a=as.integer(a))
}
set.seed(100)
onlineloc = data.frame(x = f(), y = f())
instore = data.frame(a = f(), b = f())
Z=if(onlineloc == instore)
{print(onlineloc[Z[,1] & Z[,2], ])
a=a-1
print("Package Delivered no of orders left\n")
print(a)
}else {
switch(Z,"onlineloc == instore","onlineloc != instore")
}
}else if(Sys.time()+60*30==T){
dedveh=7
dedveh=dedveh-1
} else {print("Enter Valid Time")}
#> [1] "Enter Valid Time"
i want to use switch statement as the time input is greater than system time but its giving error
Created on 2019-09-16 by the reprex package (v0.3.0)