WeBWorK Problems

Problem with R Integration Showing Plots

Problem with R Integration Showing Plots

by Jimmy Risk -
Number of replies: 1


I've been using R integration for quite some time with no issues.  I'm now trying to incorporate plots into my questions, but am getting an error.  

For reference, here is the error I get using a library problem "/Library/UBC/STAT/STAT241_251/setAssignment-05/HW05-03.pg"

ERRORS from evaluating PG file: 
Unrecognized response type: at [PG]/lib/Rserve.pm line 26 Died within Carp::croak called at line 342 of /usr/lib64/perl5/vendor_perl/5.30.3/Statistics/R/IO/Rserve.pm from within Statistics::R::IO::Rserve::_send_command called at line 234 of /usr/lib64/perl5/vendor_perl/5.30.3/Statistics/R/IO/Rserve.pm from within Statistics::R::IO::Rserve::eval called at line 26 of [PG]/lib/Rserve.pm from within Rserve::try_eval called at line 146 of [PG]/macros/RserveClient.pl from within main::rserve_eval called at line 175 of [PG]/macros/RserveClient.pl from within main::rserve_start_plot called at line 79 of (eval 8619)

Warning messages

Processing of this PG problem was not completed. Probably because of a syntax error.The translator died prematurely and no PG warning messages were transmitted. at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm line 778.

Some tidbits:

  • Questions using R without plots pose no issue (for example, /Library/UBC/STAT/STAT344/hw05/hw05_q02.pg'
  • Copying a working example gives the exact same error I wrote above (https://webwork.maa.org/wiki/R_in_WeBWorK "Displaying R Graphics") 

I'm confused because I've seen other similar errors, but nothing that is occurring only when there are plots.

Any thoughts? 

Thanks so much!

In reply to Jimmy Risk

Re: Problem with R Integration Showing Plots

by Danny Glin -

One notable difference when using R with plots is that the R server needs to create temporary files for the images, which means that the problem could be something to do with R not being able to create files.

You can try running R from the command line on your server, and then running the tempfile() command.  If you get an error there, then it will at least point you in the direction of the problem.

What version of WeBWorK and what OS are you using?