title: R - fill rows of a column down based on another row in another column
body: <p>I am reading in JSON data in RStudio that is coming from sensors driving around
     in a city.
  I am then converting this data to a dataframe with the sofa
     and jsonlite package. the data basically is sensor data, that
     consists of location data, and to each location measurement there are
     some environmental data transmitted and coded in resource paths like
     (/6/0/0 and /6/0/1 for latitude and longitude information) - due to
     the JSON data I am reading in, the location information in my R
     dataframe is in the same "value" column like the environmental data
     like humidity, CO2 etc. so I loose the location information for the
     individual observations, as the location info is also treated as
     value. see converted JSON data.frame below </p>
  
  <blockquote>
    <p>data.frame</p>
  </blockquote>
  
  <pre><code>&gt; |------------------------------------------------------- |    
  &gt; resourcePath    |     value  |UTC       |lat     |long . |
  &gt;   
  &gt; /6/0/0          |    48.18   |14:51:43 |  0     | 0      |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /6/0/1          |    16.39   |14:51:43 |  0     | 0      |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3300/515/5700  |         34 |14:52:43 |  0     | 0      |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3300/289/5700  |         15 |14:53:43 |  0     | 0      |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3300/515/5700  |        55  |4:53:47  |  0     | 0      |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3300/289/5700  |       9004 |14:54:23 |  0     | 0      |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3304/0/5700    |       367  | 14:54:34| 0      |0       |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3315/0/5700    |         47 |14:54:54 | 0      |0       |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /6/0/0          |     50.34  |14:57:11 |0       | 0      |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /6/0/1          |     20.52  |14:57:13 |0       | 0      |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3304/0/5700    |         84 |14:57:34 |0       | 0      |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3315/0/5700    |         56 |14:57:45    0       0      |
  </code></pre>
  
  <p>And here a View of the desired dataframe.</p>
  
  <p>[this is the desired df - each row has an associated "lat" and "long" information - depending on the value in the "value" column, as long as there is a new value in the "value" column.][2]</p>
  
  <pre><code>&gt; |------------------------------------------------------- |    
  &gt; resourcePath    |     value  |UTC       |lat     |long . |
  &gt;   
  &gt; /6/0/0          |    48.18   |14:51:43 |  48.18 | 16.39  |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /6/0/1          |    16.39   |14:51:43 |  48.18 | 16.39  |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3300/515/5700  |         34 |14:52:43 |  48.18 | 16.39  |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3300/289/5700  |         15 |14:53:43 |  48.18 | 16.39  |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3300/515/5700  |        55  |4:53:47  |  48.18 | 16.39  |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3300/289/5700  |       9004 |14:54:23 |  48.18 | 16.39  |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3304/0/5700    |       367  | 14:54:34| 48.18  |16.39   |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3315/0/5700    |         47 |14:54:54 | 48.18  |16.39   |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /6/0/0          |     50.34  |14:57:11 |50.34   | 20.52  |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /6/0/1          |     20.52  |14:57:13 |50.34   | 20.52  |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3304/0/5700    |         84 |14:57:34 |50.34   | 20.52  |
  &gt; |---------------|------------|---------|--------|--------|   
  &gt; /3315/0/5700    |         56 |14:57:45    50.34   20.52  |
  </code></pre>
  
  <p>I was looping - using lapply, but currently i am not getting the desired df.
  Any hints widely appreciated.
  Thomas</p>