Trailing newline causes R Error
seales opened this issue · comments
Clint Seales commented
The below commands should be equivalent, but the latter causes an error. Seems like this is because wrap_cmd
adds on a semicolon without checking to see if an actual command proceeds it:
statistics-r/lib/Statistics/R.pm
Line 810 in f5dbc80
use Statistics::R;
my $R = Statistics::R->new();
$R->run(qq{
a = 1;
b = 2;}); # no error
$R->run(qq{
a = 1;
b = 2;\n\n}); # error because of newline
The output is
Problem while running this R command:
a = 1;
b = 2;
Error:
unexpected ';' in " ;"
Execution halted