I am trying to compare several dates and times, the final goal is to create a time line of events from a list of individuals. This is a trend of blood sugars happening overnight in different dates for different subjects.
Basically every subject had a hypoglycemia episodes (low blood sugar) and I am trying to graph date and time for the blood sugar before the episode and the blood sugar after the episode. Something like First blood sugar (before the episode) >>>>>>> Hypoglycemia >>>> Blood sugar after the episode with X axis being time in hours and minutes… trying to sort out how long did it take for the blood sugar to fluctuate from normal (before), down to hypoglycemia and to recover back to normal... Data is as follows: Data frame: dm dm$date.before (blood sugar before the episode which several cases is night prior) [1] "10/4/14" "10/27/14" "10/21/14" "" "9/28/14" "9/26/14" "9/27/14" "9/4/14" "8/21/14" [10] "8/6/14" "8/8/14" "8/9/14" "8/11/14" "8/12/14" "8/13/14" dm$time.before (time of the blood sugar with prior date) [1] "21:45:00" "8:03:00" "21:52:00" "" "5:14:00" "21:27:00" "22:04:00" "21:47:00" "22:22:00" [10] "21:32:00" "0:11:00" "7:35:00" "21:40:00" "21:56:00" "6:40:00" dm$date.hypo (date of the episode) [1] "10/5/14" "10/27/14" "10/22/14" "10/23/14" "9/28/10" "9/27/14" "9/28/14" "9/5/14" "8/22/14" [10] "8/7/14" "8/8/14" "8/9/14" "8/11/14" "8/13/14" "8/13/14" dm$time.hypo (time of the episode) [1] "4:12:00" "11:52:00" "8:23:00" "12:56:00" "7:36:00" "6:34:00" "7:22:00" "3:11:00" "6:29:00" [10] "4:33:00" "4:43:00" "11:17:00" "7:22:00" "5:49:00" "8:17:00" dm$date.after (date of blood sugar after the episode - most of the time is the same day) [1] "10/5/14" "10/27/14" "10/22/14" "10/23/14" "9/28/14" "9/27/14" "9/27/14" "9/5/14" "8/22/14" [10] "8/7/14" "8/8/14" "8/9/14" "8/11/14" "8/13/14" "8/13/14" dm$time.after (time of blood sugar after the episode - a few minutes or hours after the episode) [1] "8:25:00" "12:03:00" "9:33:00" "17:02:00" "8:14:00" "7:50:00" "8:17:00" "6:16:00" "8:18:00" [10] "7:31:00" "6:18:00" "12:35:00" "8:06:00" "6:40:00" "9:02:00" All of them I joined together with chron like this: dm$chron.before<-chron (dates=dm$date.before, times = dm$time.before) [1] (10/04/14 21:45:00) (10/27/14 08:03:00) (10/21/14 21:52:00) (NA NA) [5] (09/28/14 05:14:00) (09/26/14 21:27:00) (09/27/14 22:04:00) (09/04/14 21:47:00) [9] (08/21/14 22:22:00) (08/06/14 21:32:00) (08/08/14 00:11:00) (08/09/14 07:35:00) [13] (08/11/14 21:40:00) (08/12/14 21:56:00) (08/13/14 06:40:00) dm$chron.hypo<-chron (dates=dm$date.hypo, times=dm$time.hypo) [1] (10/05/14 04:12:00) (10/27/14 11:52:00) (10/22/14 08:23:00) (10/23/14 12:56:00) [5] (09/28/10 07:36:00) (09/27/14 06:34:00) (09/28/14 07:22:00) (09/05/14 03:11:00) [9] (08/22/14 06:29:00) (08/07/14 04:33:00) (08/08/14 04:43:00) (08/09/14 11:17:00) [13] (08/11/14 07:22:00) (08/13/14 05:49:00) (08/13/14 08:17:00) However when I try to sort out the difference between both or any combination of operations dm$chron.hypo-dm$chron.before It is all messed up… [1] 2.687500e-01 1.590278e-01 4.381944e-01 NA -1.460901e+03 3.798611e-01 3.875000e-01 [8] 2.250000e-01 3.381944e-01 2.923611e-01 1.888889e-01 1.541667e-01 -5.958333e-01 3.284722e-01 [15] 6.736111e-02 Even though their class is "times" "dates" Hope someone can help me… or showing me a better way to approach the problem… Ideally wil show something like this: dm$time.to.treatment <- dm$chron.treatment-dm$chron.hypo [1] 01:43:00 00:15:00 04:21:00 00:59:00 [12] 00:03:00 00:28:00 00:33:00 00:11:00 Showing the time between those two particular events for every case… ![enter image description here][1] Graph shows a version of the final graph with only morning results… but i need to add events the night prior. To complete the table I only used time… but to do night prior i need date as well... |
This forum is for Nabble support only. You appear to have posted in the wrong place.
Try a search at: http://www.nabble.com/ to see if you can find a suitable forum.
Volunteer Helper - but recommending that users move off the platform!
Once the admin for GregHelp now deleted. |
Free forum by Nabble | Edit this page |