[R] How to plot dates

2021-03-18 Thread Jeff Reichman
Greg Based upon you last email I suspect this is what you were looking for. # create the data.frame datetime <- c("2021-03-12 05:16:46","2021-03-12 09:17:02","2021-03-12 13:31:43","2021-03-12 22:00:32", "2021-03-13 09:21:43","2021-03-13 13:51:12","2021-03-13

Re: [R] How to plot dates

2021-03-17 Thread PIKAL Petr
Hi install.packages("lubridate") does not work on Mac? Cheers Petr > -Original Message- > From: R-help On Behalf Of Gregory Coats > via R-help > Sent: Wednesday, March 17, 2021 1:11 AM > To: Daniel Nordlund > Cc: r-help mailing list > Subject: Re:

Re: [R] How to plot dates

2021-03-16 Thread Avi Gross via R-help
Gross <mailto:avigr...@verizon.net> Cc: mailto:r-help@r-project.org Subject: Re: [R] How to plot dates Thank you very much. In addition to what your did, for event 1, I would like to draw a horizontal line connecting from day 1 to day 2 to day 3 to day 4. Then, for event 2, I would like to draw

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
Thank you very much. In addition to what your did, for event 1, I would like to draw a horizontal line connecting from day 1 to day 2 to day 3 to day 4. Then, for event 2, I would like to draw a horizontal line connecting from day 1 to day 2 to day 3 to day 4. Similarly for events 3, and 4. Is

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
Dan, Thank you for this guidance. Unfortunately, I do not have the library lubridate, and I do not at this moment know where to go to get this library for an Apple MacBook. > library(lubridate) Error in library(lubridate) : there is no package called ‘lubridate’ Greg Coats Reston, Virginia USA

Re: [R] How to plot dates

2021-03-16 Thread Avi Gross via R-help
geom_text(aes(color=seq)) -Original Message- From: R-help On Behalf Of Gregory Coats via R-help Sent: Tuesday, March 16, 2021 6:32 PM To: John Fox Cc: r-help mailing list Subject: Re: [R] How to plot dates Thank you. Let me redefine the situation. Each time an event starts, I

Re: [R] How to plot dates

2021-03-16 Thread Daniel Nordlund
On 3/16/2021 3:32 PM, Gregory Coats via R-help wrote: 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

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
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

Re: [R] How to plot dates

2021-03-16 Thread Jim Lemon
Hi Greg, This example may give you a start: myDat<-read.table(text= "2021-03-11 10:00:00 2021-03-11 14:17:00 2021-03-12 05:16:46 2021-03-12 09:17:02 2021-03-12 13:31:43 2021-03-12 22:00:32 2021-03-13 09:21:43", sep=",", stringsAsFactors=FALSE)

Re: [R] How to plot dates

2021-03-16 Thread Rui Barradas
Hello, I don't really understand what is to be plotted, just the time of the event? But what event? Anyway, with the data read with Sarah's code, maybe library(ggplot2) ggplot(myDat, aes(x = datetime, y = 1)) + geom_linerange(aes(ymin = 0, ymax = 1), linetype = "dotted") + geom_point()

Re: [R] How to plot dates

2021-03-16 Thread John Fox
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

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
I need a plot that shows the date and time that each event started. This ggplot command was publicly given to me via this R Help Mailing LIst. But the result of issuing the ggplot command is an Error in FUN message. ggplot(myDat, aes(x=datetime, y = Y_Var)) + geom_point() Error in FUN(X[[i]], ...)

Re: [R] How to plot dates

2021-03-16 Thread Jeff Newmiller
So what do you want quantity on the y-axis to be? On March 16, 2021 11:45:32 AM PDT, Gregory Coats wrote: >I want to plot the date and time of the event, as reflected in data. >2021-03-11 10:00:00 >Greg Coats > >> On Mar 16, 2021, at 2:23 PM, Jeff Newmiller > wrote: >> >> You don't seem to have

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
I want to plot the date and time of the event, as reflected in data. 2021-03-11 10:00:00 Greg Coats > On Mar 16, 2021, at 2:23 PM, Jeff Newmiller wrote: > > You don't seem to have a Y_Var in your data. What is it that you want to plot? > > On March 16, 2021 9:21:05 AM PDT, Gregory Coats via

Re: [R] How to plot dates

2021-03-16 Thread Jeff Newmiller
You don't seem to have a Y_Var in your data. What is it that you want to plot? On March 16, 2021 9:21:05 AM PDT, Gregory Coats via R-help wrote: >Sarah, Thank you. Yes, now as.POSIXct works. >But the ggplot command I was told to use yields an Error message, and >there is no output plot. >Please

Re: [R] How to plot dates

2021-03-16 Thread John Fox
Dear Greg, There is no variable named Y_Var in your data set. I suspect that it's intended to be a generic specification in the recipe you were apparently given. In fact, there appears to be only one variable in myDat and that's datetime. What is it that you're trying to do? A more general

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
Sarah, Thank you. Yes, now as.POSIXct works. But the ggplot command I was told to use yields an Error message, and there is no output plot. Please help me. Greg > library(ggplot2) > myDat <- read.table(text = + "datetime + 2021-03-11 10:00:00 + 2021-03-11 14:17:00 + 2021-03-12 05:16:46 +

Re: [R] How to plot dates

2021-03-16 Thread Sarah Goslee
Hi, It doesn't have anything to do with having a Mac - you have POSIX. It's because something is wrong with your data import. Looking at the head() output you provided, it looks like your data file does NOT have a header, because there's no datetime column, and the column name is actually

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
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

Re: [R] How to plot dates

2021-03-15 Thread Jim Lemon
Hi Greg, As the POSIX conversion part is already answered, I'll add: as.Date("16/03/2021",format="%d/%m/%Y") converts to Date object and axis.Date() will display dates on the date axis in base graphics. Jim On Tue, 16 Mar 2021, 08:33 Gregory Coats via R-help I store in a text file the dates

Re: [R] How to plot dates

2021-03-15 Thread Jeff Reichman
t(myDat$ datetime, tz = "", format = "%Y-%M-%d %H:%M:%OS") # plotting ggplot(myDat, aes(datetime, )) ..... Jeff -Original Message- From: R-help On Behalf Of Gregory Coats via R-help Sent: Monday, March 15, 2021 4:34 PM To: r-help mailing list Subject: [R] How to

[R] How to plot dates

2021-03-15 Thread Gregory Coats via R-help
I store in a text file the dates and times that an event occurred. How do I direct R to import these text characters, and store the year, month, day, hour, minute, and second as a date? How do I then plot this series of dates? 2021-03-11 10:00:00 2021-03-11 14:17:00 2021-03-12 05:16:46 2021-03-12