[R] Creating list with increasing string lengths

Bert Gunter bgunter.4567 at gmail.com
Sun Jun 14 07:06:21 CEST 2015


Is this homework? Homework is deprecated here.

?lapply

is one of many possible approaches. If this is not homework, showing your
unsuccessful code would likely lead to a better learning experience for you.

Cheers,
Bert

Bert Gunter

"Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom."
   -- Clifford Stoll

On Sat, Jun 13, 2015 at 8:04 AM, Nia Gupta via R-help <r-help at r-project.org>
wrote:

> Hello,
>
> I am trying to create a list where each name would have an increasing
> vector length. For example, I am trying to obtain something that looks like
> this:
>
> [[1]][1] 2
> [[2]]
> [1] 2 4
>
> [[3]]
> [1] 1 2 3
> .....
> The numbers generated would just be any random numbers. My thought was to
> use a for-loop and the sequence function but that doesn't seem to be
> working. Any help on this would be greatly appreciated.
>
> Thank you,
>
> Nia
>
>         [[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.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list