Hi,
Is the ordering of the values returned something on what I can rely on, a form of a standard, that a function called unique in R (in futher versions) will return the uniq elements in order of they first occurcence.
> x<-c(2,2,1,2) > unique(x) [1] 2 1
Its seems not to be the standard. E.g. matlab >> x=[2,2,1,2] x = 2 2 1 2 >> unique(x) ans = 1 2
I just noted it because, the way how it is working now is extremely usefull for some applications (e.g tree traversal), so i use it in a script. But I am a little woried if I can rely on this behaviour in further versions. And furthermore can I assume that someone reading the code will think that it works in that way?
Or is it better to define a additional function?
keeporderunique<-function(x)
{
res<-rep(NA,length(unique(x))
count<-0
for(i in x)
{
if(!i%in%res)
{
count<-count+1
res[count]<-i
} }
res
}
/E
--
Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin _
tel: 0049-30-83875219 'v'
http://www.molgen.mpg.de/~wolski / \
mail: [EMAIL PROTECTED] ---W-W----
[EMAIL PROTECTED]
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-devel