0

I need to overlay multiple days of a variable onto one plot. The values are recorded in a non-uniform way. Say there can be two values with a second of difference and others with a minute from the prior value. I have a dataset called eventos which has a column named fecha as YYYY-MM-DD hh:mm:ss and a column named velocidad, both as a factor and I need to compare the values recorded according to the time of the day.

I have created and xts variable xts.velocidad using the dates as POSIXct which, just for visualization purposes, I can separate in days to plot alone as xts.velocidad["20180924"].

The post that follows by Bruno Caram Muller and answered by Jimbou almost answer my question but not close enough to what I am looking for: How to plot data in R from different days overlayed in only one day (based on hours:minutes)?

head(eventos$fecha)
[1] 2018-09-27 13:32:45 2018-09-27 13:32:46 2018-09-27 13:32:48
[4] 2018-09-27 13:32:49 2018-09-27 13:32:54 2018-09-27 13:32:55
1407340 Levels: 2018-09-27 13:32:45 2018-09-27 13:32:46 ... 2019-02-26 13:33:34

head(eventos$velocidad)
[1] 2222 2222 2340 2340 2570 2570

I wish to have a code to simply plot one day on top of another where I can differentiate each day`s record.

Carlos Cavero
  • 3,011
  • 5
  • 21
  • 41
  • 2
    It would help considerably to have an unambiguous small reproducible sample of data. This is often done best with `dput(head(x))`, since pasting just the console representation of the data can mask several things. – r2evans May 11 '19 at 22:51
  • Welcome to Stack Overflow! Please provide a [reproducible example in r](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). The link I provided, will tell you how. Moreover, please take the [tour](https://stackoverflow.com/tour) and visit [how to ask](https://stackoverflow.com/help/how-to-ask). Cheers. – M-- May 11 '19 at 23:33

0 Answers0