Not only do singularities cause havoc to the fabric of spacetime, but they also cause your table splits to fall apart and your models to break with ugly error messages.
Today’s function is a utility to evaluate an individual data column to evaluate whether it is singular (i.e. the column has constant values through all of the rows).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Is Column Singular = Function( {col}, {Default Local}, // values in the column lst = col << Get Values; // unique values tmp = Associative Array(); Insert Into( tmp, lst ); newlst = tmp << get keys; // number of unique items nUniqueValues = NItems(newlst); // return status If (nUniqueValues==1, retVal = 1 , retVal = 0 ); Return(retVal); ); |
I have a suspicion there might be a better way of doing this. Can you think of one?
thank a lot for your web site it helps a whole lot.