s <- rstack()
s <- insert_top(s, "a")
s <- insert_top(s, "b")
e <- peek_top(s)
print(e)
print(s)
## Assigning to the top data element with peek_top:
s <- rstack()
s <- insert_top(s, data.frame(a = 1, b = 1))
s <- insert_top(s, data.frame(a = 1, b = 1))
peek_top(s)$a <- 100
print(s)
peek_top(s) <- data.frame(a = 100, b = 100)
Run the code above in your browser using DataLab