I have something like this within a function: x <- as.POSIXct((substr((dataframe[z, ])$variable, 1, 8)), tz = "GMT", format = "%H:%M:%S") print(x) if ( (x >= as.POSIXct("06:00:00", tz = "GMT", format = "%H:%M:%S")) & (x < as.POSIXct("12:00:00", tz = "GMT", format = "%H:%M:%S")) ){ position <- "first" }
but I get this output: character(0) Error in if ((as.numeric(departure) - as.numeric(arrival)) < 0) { : argument is of length zero
how can I fix this so my comparison works and it prints the correct thing?
Aucun commentaire:
Enregistrer un commentaire