Php Mysql Count Rows Where Condition In Data Frame In R