Hi
First time poster. Novice R user, 1st shiny app in development.
I kind of copied the code from https://shiny.rstudio.com/gallery/plot-interaction-zoom.html
I have two plots, from the same data frame. The data frame is from a garmin FIT file and has rows of data for power, velocity etc at one second intervals. The timestamps in FIT files are weird (seconds since midnight 1989-12-31 UTC). I convert these timestamps with:
recs <- recs %>% mutate(time = as.POSIXct(timestamp, origin="1989-12-31", format="%Y-%m-%d", tz="GMT"))`
I've run velocity through a double pass Butterfield filter, and I plot a line of velocity on the y-axis and time on the x-axis. I plot below this a CdA (a calculated column) on the y against time on the x. I use code similar to the linked zooming plot example to select a portion of the velocity chart and zoom in on the CdA chart. But, I get the error in the subject:
Invalid input: time_trans works with objects of class POSIXct only
Which seems odd to me, since the code above specifically says as.POSIXct
and when I call str(MyDataFrame)
sure enough it says
'data.frame': 243 obs. of 11 variables:
$ power : num 270 263 313 338 289 313 254 216 217 227 ...
$ velocity : num 5.41 7.58 8.76 9.17 9.27 ...
$ drivetrain.loss : num 8.1 7.89 9.39 10.14 8.67 ...
$ rolling.resistence: num 6.84 9.59 11.09 11.61 11.73 ...
$ kinetic.inertial : num 1276 2509 3350 3675 3753 ...
$ aero.residual : num 255 246 293 316 269 ...
$ cda : num 2.625 0.916 0.708 0.666 0.548 ...
$ delta.kinetic : num NA 1233 841.2 324.8 77.4 ...
$ aero.res.in.acel : num NA -987.53 -548.72 -8.55 191.24 ...
$ cda.acel : num NA -3.686 -1.328 -0.018 0.39 ...
$ time : POSIXct, format: "2018-07-18 14:42:01" "2018-07-18 14:42:02" ...
My question is, what does the error mean, since time
looks like it is POSIXct format?
Many thanks in advance
Russell