[R] union empty set with an element

Berend Hasselman bhh at xs4all.nl
Mon Jan 19 17:27:11 CET 2015


> On 19-01-2015, at 17:10, Ragia Ibrahim <ragia11 at hotmail.com> wrote:
> 
> many thanks for replying
> the code 
> A is list of sets where each list element is a set
>  i<-1
> A[i]<-3
> #inside the loop
>      i<-i+1;
>      # for example  new element in the list will be {7,9}, each added separately inside the loop 
>        A[i]  <- union( A[[i]]   ,new element)
> 
> many thanks for replying
> 

Give us reproducible code and what you have tried. And show expected result.
For example: what is A?

Guessing: maybe you meant 

A[[i]]  <- union( A[[i]]   ,new element)


Berend

> Regards
> R.
> > Subject: Re: [R] union empty set with an element
> > From: bhh at xs4all.nl
> > Date: Mon, 19 Jan 2015 16:00:28 +0100
> > CC: r-help at r-project.org
> > To: ragia11 at hotmail.com
> > 
> > 
> > > On 19-01-2015, at 15:51, Ragia Ibrahim <ragia11 at hotmail.com> wrote:
> > > 
> > > Hello,
> > > I started the program with an empty set then I add and element when needed.
> > > the problem how can I add the first element to the empty set
> > > union(set_name ,element)
> > > gives "subscript out of bounds “
> > > 
> > 
> > Which program did you start?
> > Show us the code you used to get the error message.
> > 
> > Berend
> > 
> > 
> > > thanks in advance
> > > R.
> > > 
> > > [[alternative HTML version deleted]]
> > > 
> > 
> > Post in plain text, please.
> > 
> > > ______________________________________________
> > > 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.
> > 



More information about the R-help mailing list