I would like to multiply records according to a value of a variable (n in my dabatase) from the original database. How can I do this in R?
This is my db:
city Val n
1 London 4.0 5
2 Rome 2.5 6
3 Milan 3.0 4
4 Venice 2.0 5
This is what I would like to obtain:
city Val
1 London 4.0
2 London 4.0
3 London 4.0
4 London 4.0
5 London 4.0
6 Rome 2.5
7 Rome 2.5
8 Rome 2.5
9 Rome 2.5
10 Rome 2.5
11 Rome 2.5
12 Milan 3.0
13 Milan 3.0
14 Milan 3.0
15 Milan 3.0
16 Venice 2.0
17 Venice 2.0
18 Venice 2.0
19 Venice 2.0
20 Venice 2.0