Message-ID: <CA+8X3fWgvz-qp+jNVHBwwmduHh++HuPqosgEZSwqGfNuMTFWLg@mail.gmail.com>
Date: 2016-06-22T08:00:47Z
From: Jim Lemon
Subject: Generate list if sequence form two vector element
In-Reply-To: <1890354796.7443289.1466580756297.JavaMail.yahoo@mail.yahoo.com>
Hi Tanvir,
Not at all elegant, but:
make.seq<-function(x) return(seq(x[1],x[2]))
apply(matrix(c(a,b),ncol=2),1,make.seq)
Jim
On Wed, Jun 22, 2016 at 5:32 PM, Mohammad Tanvir Ahamed via R-help
<r-help at r-project.org> wrote:
> Hi,
> I want to do the follow thing
>
> Input :
> a <- c(1,3,6,9)
>
>
> b<-c(10,7,20,2)
>
>
> Expected outcome :
>
> d<-list(1:10,3:7,6:20,2:9)
>
>
>
> Thanks !!
>
>
>
> Tanvir Ahamed
> G?teborg, Sweden | mashranga at yahoo.com
>
> ______________________________________________
> 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.