Programming statistics in R

Re: Programming statistics in R

by Richard Lobb -
Number of replies: 5

I've downloaded R and found the actual error you're getting. It's in r-source/src/main/memory.c:

    R_BCNodeStackBase =
        (R_bcstack_t *) malloc(R_BCNODESTACKSIZE * sizeof(R_bcstack_t));
    if (R_BCNodeStackBase == NULL)
        R_Suicide("couldn't allocate node stack");

So certainly it's a memory error - a failed call to malloc.

I tried making a simple R test question using exactly your prototype and of course it worked fine for me :)  Here's the proof:

Proof it works

I attach the exported Moodle XML question; please try importing and running that first off. If that works on your system too, then the problem is in the setting of the memory limit. But I suspect it will fail on your system too. In which case: tell me a bit about your Jobe server. What version of Linux is it running on? Were any non-standard actions taken during the install? 

Richard


In reply to Richard Lobb

Re: Programming statistics in R

by Chris Sangwin -
Thank you Richard,

This is now working.  I think the explicit memory limit 0 has fixed this.

You help is much appreciated.  We can take this from here.

Chris


In reply to Chris Sangwin

Re: Programming statistics in R

by Richard Lobb -

Good to know the problem is fixed. However, I'd advise against using 0 for the memory limit in a production question because a memory gobbling submission might then be able to cripple Jobe. It's safer to find a value at which a typical submission will run OK and then, say, double it. 

I'm also curious as to why your Jobe server seems more prone to memory limit problems than ours. Are you perhaps running it on a 32-bit OS? 

Richard

In reply to Richard Lobb

Re: Programming statistics in R

by Richard Lobb -

I've just been asked for more information about R questions, so I'm posting an XML export of two versions of a very simple R question. One version is like the above, using a customised python3 question. The other version is split into two: a prototype to define a new question type Rtest and the actual question that uses that prototype.

Obviously R needs to be installed on Jobe for either of these questions to run.

Please realise I'm not an R programmer and cannot offer any R-specific support.

Richard

In reply to Richard Lobb

Re: Programming statistics in R

by Tim Hunt -

Here is a strange behaviour of the demo question, which I have not yet had time to debug.

I was trying to get the question wrong with minimal editing, but changing the order of the two print statements from the right answer did not break it!

Like Richard, I am not an R expert, so I have no idea why this happens. It is not imporant, but it is curious.

In reply to Tim Hunt

Re: Programming statistics in R

by Richard Lobb -

Bizarre indeed. I can't replicate it myself - with both the questions in the XML export I posted earlier the output lines change order if I swap the print statements. If you Check an unchanged answer you get the same grading output as before but I've never seen that mechanism fail to notice the changed answer. It uses (via arrays_same_at_key_missing_is_blank) a full string equality test.

Richard