Hello,
See if the following does what you need.
hours <- function(x, format = "%H:%M"){
as.integer(format(strptime(x, format = format), "%H"))
}
minutes <- function(x, format = "%H:%M"){
as.integer(format(strptime(x, format = format), "%M"))
}
x <- c("18:10", "19:43")
hours(x)
See ?strptime on how to handle time formats.
If you want to stay playing with strsplit: It actually returns a list,
hence you probably want to:
dt$hr <- sapply(tstamp, "[", 1)
Uwe Ligges
On 28.04.2013 13:48, Alexandre Karev wrote:
Hello!
I've time stamp ('time') field in dataset ('dt
2 matches
Mail list logo