php-r icon indicating copy to clipboard operation
php-r copied to clipboard

ROutputParser is parsing NA as 0

Open gb5256 opened this issue 9 years ago • 1 comments

Hi, please check this function:

public function singleNumber($output)
{
    //TODO properly check if r output is a valid number
    return 0 + substr($output, 4);
}

The problem is that if the return from R is like this: [0] NA the script will return "0". But 0 is something else than NA, right?

gb5256

gb5256 avatar Dec 15 '16 17:12 gb5256

Yeah, it should probably return null in this case. Could you please submit a PR?

kachkaev avatar Dec 15 '16 18:12 kachkaev