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)
myDat$datetime<-strptime(myDat$X,format="%Y-%m-%d %H:%M:%S")
plot(myDat$datetime,rnorm(7),type="b")

Note that I have corrected what I think is a mistake in reading in
your data. The first date has been converted into the field name by
prepending an "X" and then replacing the hyphen and semicolon
characters with periods to coerce it to a name.  I changed that back
to what I think it was and this produces s basic plot with the dates
on the abscissa and some random numbers on the ordinate.

Jim

On Wed, Mar 17, 2021 at 6:26 AM Gregory Coats via R-help
<r-help@r-project.org> wrote:
>
> 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]], ...) : object 'Y_Var' not found
> Greg Coats
>
> > On Mar 16, 2021, at 2:18 PM, John Fox <j...@mcmaster.ca> wrote:
> >
> > 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?
>
>
>         [[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.

______________________________________________
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