Skip to content
Prev 175533 / 398506 Next

Convert date to integer

thoeb <t.hoebinger <at> gmail.com> writes:
Probably you have read in the data from a file with read.table; check
stringsAsFactors in the docs to avoid the conversion from the beginning.
If that's all (no NA?) a simple replace might work

df = data.frame(tstr=c("13:00","5:30"))
df$tint = as.integer(gsub(":","",as.character(df$tstr)))


Dieter