Re: [R] Help with rep

From: Gabor Csardi <csardi_at_rmki.kfki.hu>
Date: Fri, 25 Jul 2008 04:18:03 -0500

Jacob, yes, e.g.

rep( c(4,3,4,2,3,4,1,2,3,4), 1 ) :)

Seriously, your question reminds me of (rather silly) television contents, when one should find _the_ rule in a series of numbers. :)

Here is a solution, assuming I've found the "correct" rule:

unlist(lapply(4:1, seq, 4))

Best,
Gabor

On Fri, Jul 25, 2008 at 11:07:00AM +0200, Van Wyk, Jaap wrote:
> Hi
> Is it possible to use the rep command (or maybe some other "shortcut") to create a vector with the following format:
> 4 3 4 2 3 4 1 2 3 4
>
> Any help is much appreciated.
> Thanks
> Jacob
>
>
> Jacob L van Wyk
> Department of Statistics
> University of Johannesburg, APK
> Box 524
> Auckland Park 2006
> South Africa
> Office Tel: +27 11 559 3080
> Fax: +27 11 559 2832
>
>
> [[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.

-- 
Csardi Gabor <csardi_at_rmki.kfki.hu>    UNIL DGM

______________________________________________
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 25 Jul 2008 - 09:26:04 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 25 Jul 2008 - 09:32:35 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