Terry Mu
2005-Mar-17 17:24 UTC
[R] beginner question: how to sort out distinct values from a vector
there is a vector, like: 1, 1, 1, 2, 2, 3, 3, 4, 5, 5, I'd like a function that gives me only 1, 2, 3, 4, 5 thank you
Chuck Cleland
2005-Mar-17 17:26 UTC
[R] beginner question: how to sort out distinct values from a vector
?unique Terry Mu wrote:> there is a vector, like: > 1, 1, 1, 2, 2, 3, 3, 4, 5, 5, > > I'd like a function that gives me only 1, 2, 3, 4, 5 > > thank you > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >-- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894
Marc Schwartz
2005-Mar-17 17:30 UTC
[R] beginner question: how to sort out distinct values from a vector
On Thu, 2005-03-17 at 12:24 -0500, Terry Mu wrote:> there is a vector, like: > 1, 1, 1, 2, 2, 3, 3, 4, 5, 5, > > I'd like a function that gives me only 1, 2, 3, 4, 5See ?unique HTH, Marc SChwartz
Doran, Harold
2005-Mar-17 17:35 UTC
[R] beginner question: how to sort out distinct values from a vector
You can use unique() -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Terry Mu Sent: Thursday, March 17, 2005 12:24 PM To: R-Help Subject: [R] beginner question: how to sort out distinct values from a vector there is a vector, like: 1, 1, 1, 2, 2, 3, 3, 4, 5, 5, I'd like a function that gives me only 1, 2, 3, 4, 5 thank you ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Uwe Ligges
2005-Mar-17 17:36 UTC
[R] beginner question: how to sort out distinct values from a vector
Terry Mu wrote:> there is a vector, like: > 1, 1, 1, 2, 2, 3, 3, 4, 5, 5, > > I'd like a function that gives me only 1, 2, 3, 4, 5See ?unique Uwe Ligges> thank you > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html