Stack and deque datatypes for R - fast and functional