How to use a loop to get the following result in R through loop functions that summarizes my dates with my value box ? : [This is the current form of input data which I want to convert into the other image here][1] 
[This is the expected output][2]


  [1]: https://i.stack.imgur.com/WWlRv.png
  [2]: https://i.stack.imgur.com/n1YBw.png