How do I repeat each element of a list n times and form a new list? For example:
x=[1,2,3,4]
n=3
Looking for:
[1,1,1,2,2,2,3,3,3,4,4,4]
An inner argument to repeat is what I was looking for:
repeat([1, 2, 3, 4], inner = 3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With