[R] generate repeats of a vector's elements

From: Chaofeng Kou <kouchaofeng_at_gmail.com>
Date: Fri, 18 Jul 2008 13:21:52 +0100


Dear all,

I have got a question for generating repeats of a vector's elements. Please don't hesitate to email me back and say that it is very easy although I can't find a method to solve it.

If I have a n-vector b, whose elements are b[1], b[2], ..., b[n], how can I generate such a vector

  b[1], b[1], b[2], b[1], b[2], b[3], b[1], b[2], b[3], b[4], ......, b[1], b[2], ..., b[n]

which contains n(n+1)/2 elements.

Thanks very much.

Regards
Chaofeng Kou

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 18 Jul 2008 - 12:29:37 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jul 2008 - 13:31:56 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive