title: Subset by first and last value per group
body: <p>I have a data frame in R with two columns <strong>temp</strong> and <strong>timeStamp</strong>. The data has <strong>temp</strong> values regularly. A portion of dataframe looks like- </p>
  
  <p><a href="https://i.stack.imgur.com/LUJdr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LUJdr.png" alt="enter image description here"></a></p>
  
  <p>I have to create line chart showing changes in temp over time. As can be seen here, <strong>temp</strong> values remain the same for several <strong>timeStamp</strong>. Having these repeating value increases the size of data file and I want to remove them. So the output should look like this-</p>
  
  <p><a href="https://i.stack.imgur.com/QnBly.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QnBly.png" alt="enter image description here"></a></p>
  
  <p>Showing just the values where there is a change.
  Cannot think of a way to get this think done in R. Any inputs in the right direction would be really helpful.</p>