HI @ch,
Create a list of elements and weights separately as below. Then use rep() function to replicate the list and create weighted data.
Example:
> el = c(1,6,2,6,2)
> wt = c(1,6,1,3,8)
> wt_df = rep(el,wt)
> el
[1] 1 6 2 6 2
> wt
[1] 1 6 1 3 8
> wt_df
[1] 1 6 6 6 6 6 6 2 6 6 6 2 2 2 2 2 2 2 2