title: Writing ggplot secondary axis formula correctly
body: <p>I need a secondary axis in R ggplot2 and can't get the formula right.
  I could not find a similar question answered in Google searches.
  This is what works:</p>
  
  <hr>
  
  <pre><code>mydata &lt;- data.frame(x = c(0, 1, 2, 3, 4, 5), 
                   y = c(20, 55, 69, 72, 73, 72))
  library(ggplot2)
  ggplot(data = mydata, aes(x = x, y = y)) +
  geom_point(shape = 21,size = 5,color = "black",fill = "orange",stroke = 1) +
  scale_x_continuous(name = 'Number of Contacts') +
  scale_y_continuous(name="Remembered (%)", 
  sec.axis = sec_axis(trans = ~. +10,name = "Remembered (Index)"))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/EVQux.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EVQux.png" alt="orginal"></a>
  However, my formula in the sec_axis part is more complicated and should be something like</p>
  
  <pre><code>secondary axis =  (y - min(y)) * 100/(max(y)- min(y))
  </code></pre>
  
  <p>so secondary axis would be </p>
  
  <pre><code>c(0.00000,  66.03774,  92.45283,  98.11321, 100.00000,  98.11321)
  </code></pre>
  
  <p>in this example. The idea is to have an index on the right of the diagram 
  that allows to find the 70-80% range of given values.</p>
  
  <p>I tried different versions of <code>I()</code> but in vain. 
  Any ideas are welcome. Also any document explaining the formula part of the function more thoroughly
  would be welcome. ?formula did not help me much in this.</p>