title: Writing a median function in R
body: <p>I have been tasked to write my own median function in R, without using the built-in median function. If the numbers are odd; calculate the two middle values, as is usual concerning the median value. 
  Something i probably could do in Java, but I struggle with some of the syntax in </p>
  
  <p><strong>R Code:</strong></p>
  
  <pre><code>list1 &lt;- c(7, 24, 9, 42, 12, 88, 91, 131, 47, 71)
  
  sorted=list1[order(list1)]
  sorted
  n = length(sorted)
  n
  if(n%2==0) # problem here, implementing mod() and the rest of logic.
  </code></pre>