Add r code for getting model output