How to analyse each individual vector value in an if statement
<p>I'm trying to use an if statement to analyse the number of user-inputted values greater than or equal to 70. For every value they input greater than (or equal to) 70, I want the variable <code>totalFirst</code> to increase by 1. However, I am not sure how to make an if statement analyse each individual value in a vector.</p>

<p>Code so far:</p>

<pre><code>totalFirst &lt;- 0

prompt &lt;- "What were your second year module results?(space separated)"
secondYearMark &lt;- as.integer(strsplit(readline(prompt), " ")[[1]])
if (secondYearMark &gt;= 70) totalFirst &lt;- totalFirst + 1
</code></pre>