More than one value for “each” argument in “rep” function (R) ?

前端 未结 1 1805
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 14:53

How to assign more than one value for \"each\" argument in \"rep\" function in R? A trivial example, where each value in a vector is 3-times repeated in a row:



        
相关标签:
1条回答
  • 2020-11-30 15:09

    well, depending on what you think the output should be, I'm guessing you want the times= parameter

    rep (a, times=c(2,4,7))
    # [1] 2 2 4 4 4 4 6 6 6 6 6 6 6
    

    See ?rep for the difference

    0 讨论(0)
提交回复
热议问题