Hi,

On Tue, Feb 2, 2010 at 1:19 PM, anna <lippelann...@hotmail.com> wrote:
>
> Hello everyone,
> I am trying to retrieve the list of distinct values within a whole data
> frame. I tried to use unique() function but it retrieves the distinct values
> within each column or row, I want it for the entire data frame, any idea?

Here's one way:

R> df <- data.frame(a=c(1,2,3,4,3,2), b=c(4,5,6,6,4,3))
R> unique(unlist(df))
[1] 1 2 3 4 5 6

I guess funny things might happen when the columns of your data.frame
are of different types, though ...

-steve
-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to