title: How to make x and y coordinates as variables when adding point to ggplot?
body: <p>I am adding a point to a ggplot, how can I make the x and y coordinates as variables? I tried this code, but it does not work</p>
  
  <pre><code>func &lt;- function(data){
  
    meanx &lt;- mean(data[,1])
    meany &lt;- mean(data[,2])
  
    p &lt;- ggplot(data, aes(x = data[,1], y = data[,2]))
    p + 
    geom_point(size = 5, shape = 19, color = "#00FF00",
           aes(x = meanx, y = meany))
  
  }
  
  func(iris)
  </code></pre>
  
  <p>I have the following error:</p>
  
  <pre><code>Error in eval(expr, envir, enclos) : object 'meanx' not found
  </code></pre>
  
  <p>Can anyone help me please?</p>