\begin{Schunk}
\begin{Sinput}
 calcMed <- function(x, ind){
    median(x[ind])
  }
\end{Sinput}
\end{Schunk}
