dataframe - Handling integer times in R -
times in data frame recorded integers in: 1005,1405,745,1130,2030 etc. how convert these integers r understand , use in functions such strptime. in advance help solution using strptime() as pointed out psidom in comment, can convert integers character , use strptime() : int_times <- c(1005,1405,745,1130,2030) strptime(as.character(int_times), format="%h%m") ## [1] "2016-04-21 10:05:00 cest" "2016-04-21 14:05:00 cest" na ## [4] "2016-04-21 11:30:00 cest" "2016-04-21 20:30:00 cest" however, can see, run trouble number has 3 digits. can around using formatc() format integers character 4 digits , leading 0 (if needed): char_times <- formatc(int_times, flag = 0, width = 4) char_times [1] "1005" "1405" "0745" "1130" "2030" now, conversion works: strptime(char_times, format="%h%m") ## [1] "2016-04-21 10:05:00 cest" ...