Вот решение:
time <- data.frame(c('413','516','2344','644','1233'), c('300','833','1700','2230','1800'))
colnames(time) <- c("dep_time", "sched-dep-time")
x1 <- as.vector(time[,1])
x2 <- as.vector(time[,2])
mins <- substr(x1, nchar(x1)-1, nchar(x1))
hour <- substr(x1, 0, nchar(x1)-2)
time[,1] <- paste0(hour, ':', mins)
mins <- substr(x2, nchar(x2)-1, nchar(x2))
hour <- substr(x2, 0, nchar(x2)-2)
time[,2] <- paste0(hour, ':', mins)
Результаты:
dep_time sched-dep-time
1 4:13 3:00
2 5:16 8:33
3 23:44 17:00
4 6:44 22:30
5 12:33 18:00