title: R legend not working
body: <p>I'm an R newbie. I'm plotting 4 approximation to a line. I want to put the legend on a top corner. I've tried:</p>
  
  <pre><code>legend(
  "topleft", legend=....)
  </code></pre>
  
  <p>Then I tried to manually set the position still not working. Below is my code and my plot:</p>
  
  <pre><code> plot(1:N, vRm, pch=".", col="blue", xlab="m", ylim=c(0.885, 0.91)) 
   ylab="approximated 90th percentile")
   lines(1:N, v1m, pch=".", col="yellow")   
   lines(1:N, v2m, pch=".", col="green")
   lines(1:N, v3m, pch=".", col="red")
  
   legend(
   y=0.92, legend=c("quantile","90st", "91st", 
   "(90st+91st)/2"), col=c("blue", "yellow", "green", "red"),   pch=c(".",".", ".", ".")
   )
  </code></pre>
  
  <p>and the plot:</p>
  
  <p><img src="https://i.stack.imgur.com/jHCY7.png" alt="enter image description here"></p>
  
  <p>how can I place the legend on a top corner?</p>