[R] Inserting a subsequence between values of a vector

From: Serguei Kaniovski <Serguei.Kaniovski_at_wifo.ac.at>
Date: Tue, 4 Dec 2007 16:49:31 +0100


suppose I have a vector:

x <- c(1,1,1,2,2,3,3,3,3,3,4)

How can I generate a vector/sequence in which a fixed number of zeroes (say 3) is inserted between the consecutive values, so I get


thanks a lot,

        [[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 Tue 04 Dec 2007 - 15:56:30 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 Tue 04 Dec 2007 - 17:30:18 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.