Count Object In Array Javascript Append Function In R