I have a data table that looks like this:
ID time somevalues change
001 12:33 13 NA
002 12:34 27 speed: 34
003 12:35 45 width: 127
004 12:36 41 NA
005 12:37 44 height: 19.2
006 12:35 45 NA
007 12:36 49 speed: 35
008 12:37 44 speed: 27
009 12:38 45 NA
010 12:39 44 NA
011 12:40 44 height: 18, speed: 28
012 12:41 40 NA
013 12:42 44 height: 18.1
014 12:43 55 width: 128.1
015 12:44 41 NA
... ... ... ...
The table consists of various measurements of a sensor. Some of the measurements have only been entered if they have changed. In addition, these measurements were always entered in the same column. What I need is a data table, which looks like this:
ID time somevalues speed height width
001 12:33 13 34 19.1 128
002 12:34 27 34 19.1 128
003 12:35 45 34 19.1 127
004 12:36 41 34 19.1 127
005 12:37 44 34 19.2 127
006 12:35 45 34 19.2 127
007 12:36 49 35 19.2 127
008 12:37 44 27 19.2 127
009 12:38 45 27 19.2 127
010 12:39 44 27 19.2 127
011 12:40 44 28 18 127
012 12:41 40 28 18 127
013 12:42 44 28 18.1 127
014 12:43 55 28 18.1 128.1
015 12:44 41 28 18.1 128.1
... ... ... ... ... ...
I need the data in this format to analyze and visualize it. Is there a way to do that in R without using multiple if statements?