I have a data frame (hf) that is all set up and the dates are working fine - however I need to extract the months and hours (2 separate columns) as numbers - however they are coming out as characters.

I have tried both the following:

hf50$hour <- hf50$date
hf50$hour <- format(hf50["hour"],"%H")

and

hf$month <- as.POSIXct(strptime(hf$date, format = "%m"))

but they are still coming out as characters.

Any ideas please?
Thanks,
Tim.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to