Create Subarray From Array Javascript Split Function In R