Postgresql Count Number Of Rows In R