--- loncom/homework/lonr.pm 2009/09/02 14:13:16 1.10 +++ loncom/homework/lonr.pm 2024/06/21 23:42:49 1.12 @@ -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.12 2024/06/21 23:42:49 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'; } @@ -239,9 +243,9 @@ sub blacklisted { } sub r_allowed_libraries { - return ('alr3','boot','car','class','cluster','datasets','Hmisc','KernSmooth','leaps','lmtest', - 'MASS','methods','mgcv','nlme','nnet','qAnalyst','quadprog','rpart','SuppDists','spatial', - 'splines','stats','stats4','survival','tseries','zoo'); + return ('alr3','boot','car','class','cluster','datasets','FactoMineR','Hmisc','KernSmooth','leaps', + 'lmtest','MASS','mdatools','methods','mgcv','nlme','nnet','qAnalyst','quadprog','rpart', + 'SuppDists','spatial','splines','stats','stats4','survival','tseries','zoo'); } sub r_is_allowed_library {