I am trying to make box plots on the depth movement of 3 fish. One of the boxplots I want it as hourly bins, with the X axis going from 0-25 hours and the other as monthly bins. How do I do hourly or monthly bins of depth to then make boxplots? Could someone help me out, please?
head(tagdataRaw2)
transmitter ID det_Time detection_time_ast station sensor_value sensor_unit species Easting Northing sp_code Sp_ID
1 A69-9002-10979 10979 19:32:20 2016-06-26 15:32:20 252 9.0959 m Megalops atlanticus 290481.2 2028719 MA MA-10979
2 A69-9002-10979 10979 19:54:12 2016-06-26 15:54:12 252 1.5159 m Megalops atlanticus 290481.2 2028719 MA MA-10979
3 A69-9002-10979 10979 19:58:31 2016-06-26 15:58:31 247 -0.3033 m Megalops atlanticus 290669.4 2028720 MA MA-10979
4 A69-9002-10979 10979 20:11:58 2016-06-26 16:11:58 252 8.4895 m Megalops atlanticus 290481.2 2028719 MA MA-10979
5 A69-9002-10979 10979 20:15:41 2016-06-26 16:15:41 248 2.4255 m Megalops atlanticus 290291.9 2028713 MA MA-10979
6 A69-9002-10979 10979 20:30:53 2016-06-26 16:30:53 248 4.2447 m Megalops atlanticus 290291.9 2028713 MA MA-10979
Date Time dayNight Dawn Dusk datetime depth Month
1 2016-06-26 15:32:20 Day Other Other 2016-06-26 15:32:20 9.0959 Jun 2016
2 2016-06-26 15:54:12 Day Other Other 2016-06-26 15:54:12 1.5159 Jun 2016
3 2016-06-26 15:58:31 Day Other Other 2016-06-26 15:58:31 -0.3033 Jun 2016
4 2016-06-26 16:11:58 Day Other Other 2016-06-26 16:11:58 8.4895 Jun 2016
5 2016-06-26 16:15:41 Day Other Other 2016-06-26 16:15:41 2.4255 Jun 2016
6 2016-06-26 16:30:53 Day Other Other 2016-06-26 16:30:53 4.2447 Jun 2016
bplotmt<-ggplot(tagdataRaw2, aes(datetime, depth)) +
geom_boxplot() +
facet_wrap(~Sp_ID, labeller = label_parsed) +
scale_x_datetime(name="Date", date_breaks="1 months", labels=date_format(format="%b-%Y"))+
ylab("Depth (m)") +
ggtitle("Vertical monthly distribution of Atlantic tarpon") +
scale_y_reverse()
bplotmt