As Josh O'Brien suggested, you can do this with read.zoo
:
library(zoo)
Lines <- "20151230T090029, 33.04
20151230T090029, 33.06
20151230T090029, 33.07
20151230T090029, 33.05
20151230T090029, 33.04
20151230T090029, 33.05
20151230T090029, 33.04"
z <- read.zoo(text=Lines, sep=",", FUN=as.POSIXct, format="%Y%m%dT%H%M%S")
Then you could deal with the identical timestamp issue Gabor mentioned by converting to xts and using xts::make.index.unique
.
library(xts)
x <- as.xts(z)
options(digits.secs=3)
(u <- make.index.unique(x, 0.001))
# [,1]
# 2015-12-30 09:00:29.000 33.04
# 2015-12-30 09:00:29.000 33.06
# 2015-12-30 09:00:29.001 33.07
# 2015-12-30 09:00:29.002 33.05
# 2015-12-30 09:00:29.003 33.04
# 2015-12-30 09:00:29.004 33.05
# 2015-12-30 09:00:29.005 33.04
See How R formats POSIXct with fractional seconds for why the fractional seconds print in a way that makes them look incorrect.