Skip to content
Back to formatted view

Raw Message

Message-ID: <20160315124136.Horde.c44DHCZU0-qpr1S2jUnLFge@mail.sapo.pt>
Date: 2016-03-15T12:41:36Z
From: Rui Barradas
Subject: List funtion
In-Reply-To: <CAHxKz8ZgH1Qt8vLW-H6xpSQsMNW58teOKn0k+vfBmxvOS2ouCQ@mail.gmail.com>

Hello,

rep() is vectorized so you can do

rep (my_list, 2:3)

Hope this helps,

Rui Barradas
?

Citando Andr? Luis Neves <andrluis at ualberta.ca>:

> Dear,
>
> I have the following data:
>
> v1 <- c(8,4,9,12)
> v2 <- c(7, 8, 11)
> my_list <- list(v1,v2)
> rep (my_list,3)
>
> My question is how I can modify my command line to create a list  
> called my_list
> containing two copies of the first vector (v1) and three copies of the vector
> 2 (v2).
>
> The above command line creates 3 copies of both vectors, but I would like
> to create 2 copies of one and 3 from the other, and return these results
> within my_list object.
>
> Thanks,
>
> Andre
>
> ? ? ? ? [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide  
> http://www.R-project.org/posting-guide.htmland provide commented,  
> minimal, self-contained, reproducible code.

?

	[[alternative HTML version deleted]]