Thanks for your help Petr

I think I understand better now.


> > > Masechaba$unique[which(is.na(unique(Masechaba$PROPDESC))==FALSE)]=TRUE
>                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This seems to be strange. At first sight I am puzzlet what result I shall
> expect from such construction.
>
> About your comment above: I looked at the construction again. This was
absolutely unsuited to what I actually had in mind and based on a wrong
understanding of how unique() functions. When one uses is.na(unique(x)) the
answer is FALSE as long a there is something unique - which there will
always be as long as there are any values. It therefore produces a list of
FALSE the same length as the result of unique. which() gives the indices
namely 1:length(unique(x))

The desired result (a true or false value indicating whether a variable is a
duplicate or not is obtained by

Masechaba$unique=duplicated(match(Masechaba$PROPDESC,unique(Masechaba$PROPDESC)))

Thanks again for your help

regards
Christiaan

        [[alternative HTML version deleted]]

______________________________________________
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