|
From: Mario R. <bio...@te...> - 2017-07-10 08:42:42
|
El 10/07/17 a las 04:17, Dr. M Kanagasabapathy escribió: > Dear Maxima members, > Is there any specific function to find the duplicate entries in the list. > I know the function Unique(L) returns all members in the list but not > duplicate. > It excludes the duplicate. > > L: [a,b,a,c,d,f,c] > In this list > Duplicate(L) should returns a, c. > > > Thanks for the help. > Regards I think we don't have such a function, but we can build one with some help of package descriptive: load(descriptive)$ nfreq(l, k):= submatrix(subsample (transpose(apply(matrix,discrete_freq (l))), lambda([v], v[2] = k)),2); nfreq returns a column matrix with the elements in list l which are repeated k times. Examples: m: [1, 0, 1, 1, 2, 6, 2, 5, 0, 4]; nfreq(m,2); /* duplicated entries */ nfreq(m,3); /* triplicated entries */ -- Mario http://www.tecnostats.net |