title: Extract maxmimum and minimum from head() function?
body: <p>I am analysing segments of vectors, and for that I need to extract their maximum.</p>
  
  <p>The normal way to do this would be with <code>max(vector, na.rm = TRUE)</code>.
  However, in some segments the actual maximum of the vector doesn't appear, so it gives the maximum of that segment of the vector.</p>
  
  <p>For this, I want to extract the maximum from the head() function, as it appears here:</p>
  
  <pre><code>library(expss)
  
  nps = c(-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1)
  
  var_lab(nps) = "Net promoter score"
  val_lab(nps) = num_lab("-1 Detractors
                           0 Neutralists    
                           1 Promoters")
  
  head(nps)
  
  Output:
  Detractors  -1  Detractors      
  Neutralists  0  Neutralists     
  Promoters    1  Promoters
  </code></pre>
  
  <p>In this case, I would want to extract '1' from the middle column. I have tried turning the output of head() into a dataframe but that just gives the first 5 values of the vector. Any ideas?</p>