This function converts myClim object to long R data.frame.
mc_reshape_long(data, localities = NULL, sensors = NULL, use_utc = TRUE)
myClim object see myClim-package
names of localities; if NULL then all (default NULL)
names of sensors; if NULL then all (default NULL) see names(mc_data_sensors)
if FALSE, then the time shift from tz_offset
metadata is used to correct
(shift) the output time-series (default TRUE)
In the Agg-format myClim object use_utc = FALSE
is allowed only for steps shorter than one day. In myClim
the day nd longer time steps are defined by the midnight, but this represent whole day, week, month, year...
shifting daily, weekly, monthly... data (shift midnight) does not make sense in our opinion.
But when user need more flexibility, then myClim Raw-format
can be used, In Raw-format use_utc
is not limited, user can shift an data without the restrictions.
See myClim-package
data.frame
columns:
locality_id
serial_number
sensor_name
height
datetime
time_to
value
head(mc_reshape_long(mc_data_example_clean, c("A6W79", "A2E32"), c("TMS_T1", "TMS_T2")), 10)
#> locality_id serial_number sensor_name height datetime
#> 1 A2E32 94184103 TMS_T1 soil 8 cm 2020-10-16 06:15:00
#> 2 A2E32 94184103 TMS_T1 soil 8 cm 2020-10-16 06:30:00
#> 3 A2E32 94184103 TMS_T1 soil 8 cm 2020-10-16 06:45:00
#> 4 A2E32 94184103 TMS_T1 soil 8 cm 2020-10-16 07:00:00
#> 5 A2E32 94184103 TMS_T1 soil 8 cm 2020-10-16 07:15:00
#> 6 A2E32 94184103 TMS_T1 soil 8 cm 2020-10-16 07:30:00
#> 7 A2E32 94184103 TMS_T1 soil 8 cm 2020-10-16 07:45:00
#> 8 A2E32 94184103 TMS_T1 soil 8 cm 2020-10-16 08:00:00
#> 9 A2E32 94184103 TMS_T1 soil 8 cm 2020-10-16 08:15:00
#> 10 A2E32 94184103 TMS_T1 soil 8 cm 2020-10-16 08:30:00
#> time_to value
#> 1 2020-10-16 06:30:00 9.6875
#> 2 2020-10-16 06:45:00 9.6875
#> 3 2020-10-16 07:00:00 9.6875
#> 4 2020-10-16 07:15:00 9.6250
#> 5 2020-10-16 07:30:00 9.6875
#> 6 2020-10-16 07:45:00 9.6875
#> 7 2020-10-16 08:00:00 9.6875
#> 8 2020-10-16 08:15:00 9.6250
#> 9 2020-10-16 08:30:00 9.6250
#> 10 2020-10-16 08:45:00 9.6250