My computer is an Apple MacBook. I do not have POSIX. 
The command
myDat$datetime <- as.POSIXct(myDat$datetime, tz = "", format = "%Y-%M-%d 
%H:%M:%OS")
yields the error
Error in `$<-.data.frame`(`*tmp*`, datetime, value = numeric(0)) : 
  replacement has 0 rows, data has 13
Please advise, How to proceed?
Greg Coats

> library(ggplot2)
> # Read a txt file on the Desktop, named "myDat.txt"
> myDat <- read.delim("~/Desktop/myDat.txt", header = TRUE, sep = ",")
> head(myDat)
  X2021.03.11.10.00.00
1  2021-03-11 14:17:00
2  2021-03-12 05:16:46
3  2021-03-12 09:17:02
4  2021-03-12 13:31:43
5  2021-03-12 22:00:32
6  2021-03-13 09:21:43
> # convert data to date time object
> myDat$datetime <- as.POSIXct(myDat$datetime, tz = "", format = "%Y-%M-%d 
> %H:%M:%OS")
Error in `$<-.data.frame`(`*tmp*`, datetime, value = numeric(0)) : 
  replacement has 0 rows, data has 13
> 
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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