my matrix is:
> d1
a b
[1,] 1 2
[2,] 2 2
[3,] 4 1
If I do the following I got the result:
> rep(1,d1[1,2])
[1] 1 1
> rep(1,d1[2,2])
[1] 1 1
> rep(1,d1[3,2])
[1] 1
But why getting invalid 'times' argument for the following:
>j=c(1:3)
>> j
[1] 1 2 3
> rep(1,d1[j,2])
Error in rep(1, d1[j, 2]) : invalid 'times' argument