[R] How to plot dates
gregco@t@ @end|ng |rom me@com
Tue Mar 16 23:32:23 CET 2021
Thank you. Let me redefine the situation.
Each time an event starts, I record the date and time.
Each day there are 4 new events. Time is the only variable.
I would like to graphically show how the time for events 1, 2, 3, and 4 for the current day compare to the times for events 1, 2, 3, and 4 for the previous day. How would I plot / display those times differences?
myDat <- read.table(text =
sep = ",", header = TRUE)
myDat$datetime <- as.POSIXct(myDat$datetime, tz = "", format ="%Y-%M-%d %H:%M:%OS")
> On Mar 16, 2021, at 3:34 PM, John Fox <jfox using mcmaster.ca> wrote:
> Dear Greg,
> Coordinate plots typically have a horizontal (x) and vertical (y) axis. The command
> ggplot(myDat, aes(x=datetime, y = datetime)) + geom_point()
> works, but I doubt that it produces what you want.
> You have only one variable in your data set -- datetime -- so it's not obvious what you want to do. If you can't clearly describe the structure of the plot you intend to draw, it's doubtful that I or anyone else can help you.
> John Fox, Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> web: https://socialsciences.mcmaster.ca/jfox/ <https://socialsciences.mcmaster.ca/jfox/>
[[alternative HTML version deleted]]
More information about the R-help