Arraylist Length Function In R