title: For loops in R and computational speed
body: <p>In the past I have written R code that requires for loops inside of for loops. Generally this code is rather time consuming to execute. I have read online this is a result of how for loops in R work. I have also read that using for loops in another language inside R e.g. C++ or Java, can speed up the computational time. </p>
  
  <p>Does anyone have experience with this and can point me to some simple examples that I can read?</p>
  
  <p>Also can you call another language for the for loop, but still have everything inside the loop be in standard R code?</p>