[R] Plot function: hourly data and x-axis

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Thu Aug 9 19:23:43 CEST 2018


Pre-process your data into per-day or per-month records, then plot it. There are many ways to do this... for example, base R has the aggregate function, and the dplyr package has the group_by/summarise functions, and the data.table package can do this as well (read the vignettes).

All of these techniques require that you learn how to deal with timestamps using one or more of the time classes. The most common of these can be introduced by reading

?DateTimeClasses

and/or reading some of the fine blogs online regarding this topic. Note that the trunc.POSIXt function offers one way to identify which time interval each record of your data belongs to.

If you need more assistance, read the Posting Guide and create a reproducible example similar to the data you are working with, and be sure to post it using plain text so it does not get corrupted in the mailing list.

On August 9, 2018 7:51:19 AM PDT, Edoardo Silvestri <silvestri.casali using gmail.com> wrote:
>Hi all,
>I have a little problem with plot function..
>I have an hourly dataset and I would like plot a variable with x-axis
>based
>on daily or monthly frequency, just to have a better visualization and
>avoid on x-axis all hours of the dataset.
>
>Do you know what is the solution?
>Thanks
>Edo
>
>	[[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.

-- 
Sent from my phone. Please excuse my brevity.




More information about the R-help mailing list