Xmen001
Xmen001

Reputation: 11

Repeat sequence multiple times (seq and rep functions)

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?

Upvotes: 1

Views: 513

Answers (1)

Hugh
Hugh

Reputation: 16099

You have the functions the wrong way around.

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

Upvotes: 2

Related Questions