--- loncom/homework/lonr.pm 2009/09/02 14:13:16 1.10 +++ loncom/homework/lonr.pm 2014/11/19 21:14:47 1.11 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Interface routines to R CAS # -# $Id: lonr.pm,v 1.10 2009/09/02 14:13:16 www Exp $ +# $Id: lonr.pm,v 1.11 2014/11/19 21:14:47 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -53,7 +53,9 @@ sub Rcroak { # sub Rpeel { my $x = $_[0]; # the string containing the serialized R object(s) - if ($x =~ /^((?:i|d):(.+?);)(.*)$/) { + if ($x =~ /^N\;(.*)$/) { + return ('',$1); + } elsif ($x =~ /^((?:i|d):(.+?);)(.*)$/) { return ($1, $+); # x starts with a number } elsif ($x =~ /^s:(\d+):/) { my $n = $1; # x starts with a string of length n @@ -147,6 +149,8 @@ sub Rreturn { } if ($errormsg) { return $errormsg; } return \%h; # return a reference to the hash + } elsif ($x eq '') { + return ''; } else { return 'Unrecognized output'; }