You can also try a combination of converting your factor into a POSIXt object and then use the format function. I am not sure how effective this method is.
Time <- factor("08:01:01") hour = format(as.POSIXct(Time,format="%H:%M:%S"),"%H") minute = format(as.POSIXct(Time,format="%H:%M:%S"),"%M") paste(hour,minute,sep=":") [1] "08:01"
source share