Repeat sequence multiple times (seq and rep functions)

时间:2019-02-10 13:18:27

标签: r

I have the code below;

seq(rep(1, 7, by = 2), times = 7)

which gives an error shown below;

Warning message: In seq.default(rep(1, 7, by = 2), times = 3) : extra argument 'times' will be disregarded Error: 'from' must be of length 1

How do I rectify the error?

1 个答案:

答案 0 :(得分:2)

您使用错误的功能。

rep(seq(1, 7, by = 2), times = 7)