Tesla Powerwall data is recorded in 5 minute intervals. The date format is presented as a character string with date and time separated by a "T" and timezone added as "+12:00", aka NZST, an example of which looks like this: "2022-12-23T00:00:00+13:00".
I have attempted separating date and time using separate after a str_replace "T" with a space " ", but after that, nothing much worked without an "Error in mutate():".
Any suggestions for the best way to process the date and time in a data table.
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
ymd_hms("2022-12-23T00:00:00+13:00",tz = "Pacific/Auckland")
#> Date in ISO8601 format; converting timezone from UTC to "Pacific/Auckland".
#> [1] "2022-12-23 NZDT"
Thanks for the example. I manage to make things more complex than needed. My intention is to use the data table to analyse the house demand, seasonal solar production and visualise the data in ggplot().
Once the date is formatted, I can aggregate diurnal trends and generate a heat map.
Thanks Richard, the timezone isn't needed if data is analysed locally, but having time correctly formatted allows data to be compared to regional data. Using ymd_hms("2022-12-23T00:00:00+13:00"), data can be mutated into variables of date and time.