Re: [R] table and unique seems to behave differently

2019-12-10 Thread William Dunlap via R-help
__ > De : Chris Evans > Envoyé : mardi 10 décembre 2019 15:41 > À : Alain Guillet > Cc : r-help@r-project.org > Objet : Re: [R] table and unique seems to behave differently > > This doesn't answer your question but I get exactly the same vector o

Re: [R] table and unique seems to behave differently

2019-12-10 Thread Alain Guillet
Thanks a lot, it answers my question. Alain De : Jeff Newmiller Envoy� : mardi 10 d�cembre 2019 16:31 � : r-help@r-project.org ; Duncan Murdoch ; Alain Guillet ; r-help@r-project.org Objet : Re: [R] table and unique seems to behave differently I think the

Re: [R] table and unique seems to behave differently

2019-12-10 Thread Duncan Murdoch
On 10/12/2019 10:32 a.m., Sarah Goslee wrote: Back to the table part of the question, but using Duncan's example. x <- c(3.4, 3.4 + 1e-15) unique(x) [1] 3.4 3.4 table(x) x 3.4 2 The question was, why are these different. table() only works on factors, so it converts the numeric vector t

Re: [R] table and unique seems to behave differently

2019-12-10 Thread Alain Guillet
c : r-help@r-project.org Objet : Re: [R] table and unique seems to behave differently This doesn't answer your question but I get exactly the same vector of length 210 with unique(toto) and names(table(toto)) using the same version of R that you are and I can't see any obvious reason w

Re: [R] table and unique seems to behave differently

2019-12-10 Thread Sarah Goslee
Back to the table part of the question, but using Duncan's example. > x <- c(3.4, 3.4 + 1e-15) > unique(x) [1] 3.4 3.4 > table(x) x 3.4 2 The question was, why are these different. table() only works on factors, so it converts the numeric vector to a factor before tabulation. factor() tries to

Re: [R] table and unique seems to behave differently

2019-12-10 Thread Jeff Newmiller
I think the question was about table vs unique. Table groups by character representation, unique groups by the underlying representation. On December 10, 2019 7:03:34 AM PST, Duncan Murdoch wrote: >On 10/12/2019 3:53 a.m., Alain Guillet wrote: >> Hi, >> >> I have a vector (see below the dput)

Re: [R] table and unique seems to behave differently

2019-12-10 Thread Duncan Murdoch
On 10/12/2019 3:53 a.m., Alain Guillet wrote: Hi, I have a vector (see below the dput) and I use unique on it to get unique values. If I then sort the result of the vector obtained by unique, I see some elements that look like identical. I suspect it could be a matter of rounded values but tab

Re: [R] table and unique seems to behave differently

2019-12-10 Thread Chris Evans
To: r-help@r-project.org > Sent: Tuesday, 10 December, 2019 09:53:29 > Subject: [R] table and unique seems to behave differently > Hi, > > I have a vector (see below the dput) and I use unique on it to get unique > values. If I then sort the result of the vector obtained b

[R] table and unique seems to behave differently

2019-12-10 Thread Alain Guillet
Hi, I have a vector (see below the dput) and I use unique on it to get unique values. If I then sort the result of the vector obtained by unique, I see some elements that look like identical. I suspect it could be a matter of rounded values but table gives a different result: unlike unique outp