This might help:
> x <- read.table("clipboard", colClasses=c("numeric", "character"))
> (x.unique <- lapply(x, unique))
$V1
[1] 155 138 126 123 103 143 111 156
$V2
[1] "A" "B" "C" "D"
> sapply(x.unique, length)
V1 V2
8 4
Andy
From: Sachin J
>
> Hi,
>
> I have a dataset which has both numeric and character
> values with dupllicates. For example:
>
> 155 A
> 138 A
> 138 B
> 126 C
> 126 D
> 123 A
> 103 A
> 103 B
> 143 D
> 111 C
> 111 D
> 156 C
>
> How can I count the number of unqiue entries without
> counting duplicate entries. Also can I extract the list in a
> object. What I mean is
> Col1 unique count = 8 Unique Elements are :
> 103,111,123,126,138,143,155,156
> Col2 unique count = 4 Unique Elements are : A,B,C,D.
>
> Any pointers would be of great help.
>
> TIA
> Sachin
>
>
>
> ---------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html