Closed bonushenricus closed 3 years ago
Thank you for using padr. Would you be so kind to create a reprex (https://reprex.tidyverse.org/), so I can reproduce the error and figure out what is wrong? Thanks!
Hi Edwin I canceled what I had done because I thought I would work differently here's how I worked now (sorry is it essential to use reprex?) `
tempo <- as.POSIXct(c("2021-05-29 17:00:00 UTC","2021-06-05 10:52:00 UTC","2021-06-01 17:00:00 UTC","2021-05-16 08:34:00 UTC","2021-06-05 17:00:00 UTC","2021-05-29 05:30:00 UTC","2021-05-23 06:30:00 UTC","2021-05-20 13:00:00 UTC","2021-05-15 12:09:00 UTC","2021-06-06 19:18:00 UTC"))
catture <- c(25,92,23,2,5,30,23,3,15,21,15,40,22)
library(data.table) arvaia_catture <- data.table(tempo,catture)
arvaia_catture_order <- arvaia_catture[order(arvaia_catture$tempo)]
arvaia_catture_order$difftime_ora <- c(0,diff(arvaia_catture_order$tempo)) arvaia_catture_order$catture_ora <- arvaia_catture_order$catture/arvaia_catture_order$difftime_ora
library(padr) arvaia_catture_ora <- thicken(arvaia_catture_order,interval = "hour") pad(arvaia_catture_ora,by=arvaia_catture_ora$tempo_hour) ` there is this similar error
Error in as.POSIXlt.character(x, tz, ...) : character string is not in a standard unambiguous format
the "tempo_hour" is in the format "%Y-%m-%d %H:%M:%S tz" with tz CEST (so Europe/Rome) but if I try Sys.setenv(TZ='UTC') and I work with UTC the problem is the same
I see. The by
argument takes a character string to indicate which column to use. Instead you are feeding it a vector. You should use:
pad(arvaia_catture_ora, by = 'tempo')
Looking at it this is not entirely obvious from the docs, I will file an issue to improve this. Also, we could throw an informative error if this happens.
Hi Edwin I have a problem with the pad function When I work with data of this format
gives me this error
Thank you