[R] Create a numeric series in an efficient way

Francesca PANCOTTO |r@nce@c@@p@ncotto @end|ng |rom un|more@|t
Thu Jun 13 16:42:19 CEST 2024


Dear Contributors
I am trying to create a numeric series with repeated numbers, not difficult
task, but I do not seem to find an efficient way.

This is my solution

blocB <- c(rep(x = 1, times = 84), rep(x = 2, times = 84), rep(x = 3, times
= 84), rep(x = 4, times = 84), rep(x = 5, times = 84), rep(x = 6, times =
84), rep(x = 7, times = 84), rep(x = 8, times = 84), rep(x = 9, times =
84), rep(x = 10, times = 84), rep(x = 11, times = 84), rep(x = 12, times =
84), rep(x = 13, times = 84))

which works but it is super silly and I need to create different variables
similar to this, changing the value of the repetition, 84 in this case.
Thanks for any help.


F.

	[[alternative HTML version deleted]]



More information about the R-help mailing list