title: How to calculate mean of an iris dataset in r as per the user input , for eg if we enter "setosa" then its mean of sepal length will be printed
body: <p>How to calculate mean of an iris data set in r as per the user input, e.g. if we enter "setosa" then the mean of sepal length will be printed. I tried using a function but I'm not able to proceed further:</p>
  
  <pre><code>tapply(iris$Sepal.Length, iris$Species, mean)
  </code></pre>
  
  <p>but not able to understand how does it work with respect to user input</p>