[R] How to plot dates

John Fox j|ox @end|ng |rom mcm@@ter@c@
Tue Mar 16 20:34:52 CET 2021

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/

On 2021-03-16 2:56 p.m., Gregory Coats via R-help 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 <jfox using 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 using 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.

More information about the R-help mailing list