f Dundee
> Mackenzie Building
> Kirsty Semple Way
> Dundee DD2 4BF
> Scotland UK
> PH: 01382-420119
>
>
> -Original Message-
> From: David Winsemius [mailto:dwinsem...@comcast.net]
> Sent: 26 February 2010 1:49 PM
> To: Henrique Dallazuanna
> Cc: Todd DeWees;
David Winsemius [mailto:dwinsem...@comcast.net]
Sent: 26 February 2010 1:49 PM
To: Henrique Dallazuanna
Cc: Todd DeWees; r-help@r-project.org
Subject: Re: [R] Unique Values of a Matrix
On Feb 26, 2010, at 8:17 AM, Henrique Dallazuanna wrote:
> Try this:
>
> unique(c(X))
I did but it retu
On Feb 26, 2010, at 8:17 AM, Henrique Dallazuanna wrote:
Try this:
unique(c(X))
I did but it returned NA as did:unique(as.vector(X)).
To get rid of the NA's I needed to do:
X[!duplicated(as.vector(X)) & !is.na(X)]
(Logical indexing and does need as.vector() , or c() , to "straighten
Scotland UK
PH: 01382-420119
-Original Message-
From: Henrique Dallazuanna [mailto:www...@gmail.com]
Sent: 26 February 2010 1:17 PM
To: Todd DeWees
Cc: r-help@r-project.org
Subject: Re: [R] Unique Values of a Matrix
Try this:
unique(c(X))
On Fri, Feb 26, 2010 at 10:06 AM, Todd DeWees
Try this:
unique(c(X))
On Fri, Feb 26, 2010 at 10:06 AM, Todd DeWees
wrote:
> I have a 280,000 x 11 matrix with various values and many NA values. What I
> would like to do is get a vector of every unique value in the matrix.
>
> For example:
>
> X = [ 1 2 NA
> 4 3 1
I have a 280,000 x 11 matrix with various values and many NA values. What I
would like to do is get a vector of every unique value in the matrix.
For example:
X = [ 12NA
43 1
7 NA 2 ]
Returns:
Unique_X = [ 1, 2, 3, 4, 7]
Thanks,
Todd
[[alte
6 matches
Mail list logo