I have imported a csv file (excel) with a timestamp and value. All my efforts to convert the timestamp column to usable time in R result in N/A. I have looked at several threads (SO and elsewhere) and tried many suggestions but somehow not managed to get it right. I have also tried various simpler examples from e.g. R-bloggers and they have worked fine.
> dframe <- read.csv2("file.csv", dec=".", colClasses=c("character","numeric"), as.is=TRUE)
> str(dframe)
'data.frame': 424 obs. of 2 variables:
$ d: chr "2016.08.02 03:59:45" "2016.08.02 04:11:16" "2016.08.02 04:22:45" "2016.08.02 04:34:13" ...
$ h: num 30 33.3 35.6 35.6 48.9 48.9 48.9 47.8 46.7 46.7 ...
This I believe is a good start. Then:
> dframe$d <- as.POSIXct(dframe$d, tz="GMT", format="%Y.%M.%D %H:%M:%S")
> str(dframe)
'data.frame': 424 obs. of 2 variables:
$ d: POSIXct, format: NA NA NA NA ...
$ h: num 30 33.3 35.6 35.6 48.9 48.9 48.9 47.8 46.7 46.7 ...
Any suggestions are welcome. I am aware of lubridate but will not be trying it, for a while at least.