I understand that you can sample elements from a list using:
list1 <- list(x, y) A <- sample(list1, 1)
If A is x, how do I store the value of y in B, without using an if statement?
A
x
y
B
if
2.1m questions
2.1m answers
60 comments
56.8k users