<p>Just containing code doesn't make it off topic; the question seems to me to be firmly on-topic. </p>

<p>In any case, in relation to programming questions (which I don't think this one actually is), the <a href="https://stats.stackexchange.com/help/on-topic">help/on-topic</a> says:</p>

<blockquote>
  <p>if it needs statistical expertise to understand or answer, ask it here </p>
</blockquote>

<p>So even if it were more of a programming-related question than it looks at first read, I think this phrase would mean it would be on topic.</p>
