4
$\begingroup$

This question already has an answer here:

Bug introduced in 10.0.0 and fixed in 10.1.0.


Has anyone had problems with the DeleteMissing function in Mathematica 10.0.2? I find that it rarely works. Most of the time it returns a list which still contains all of the missing elements. For example, let's say a = {Missing[], 1, 2, 3} then DeleteMissing[a] returns {Missing[] , 1, 2, 3}.

$\endgroup$

marked as duplicate by Szabolcs, Dr. belisarius, Michael E2, Mr.Wizard Jan 30 '15 at 0:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ have not even used it so far, but have you seen und understood the level specification you can give as second argument? Without that it will drop elements at level 1 only, which might (or might not) be your problem... $\endgroup$ – Albert Retey Jan 29 '15 at 15:09
  • 3
    $\begingroup$ Can you provide some code to reproduce the issue? $\endgroup$ – Yves Klett Jan 29 '15 at 15:13
  • $\begingroup$ @YvesKlett See my edit. $\endgroup$ – Wintermute Jan 29 '15 at 16:32
  • 1
    $\begingroup$ strange, I just tried this with 10.0.2 on Windows 7 and it seems to work (i.e. returns {1,2,3}). What system are you on? $\endgroup$ – Albert Retey Jan 29 '15 at 16:44
  • 1
    $\begingroup$ how exactly do you create such a list, by entering as input or is it returned from other functions? Can you show the offending lists when that happens with InputForm? One possible reason could be something like a "Missing"[] which as output will (with the default settings) look exactly like Missing[] but of course will not be matched by DeleteMissing... $\endgroup$ – Albert Retey Jan 29 '15 at 18:42
6
$\begingroup$

I can reproduce this problem only if the Suggestions Bar is enabled. In this case DeleteMissing seems to mysteriously lose its definition.

In[1]:= {$Version, $VersionNumber, $ReleaseNumber}
Out[1]= {"10.0 for Mac OS X x86 (64-bit) (December 4, 2014)", 10., 2}

In[2]:= a = {Missing[], 1, 2, 3}
Out[2]= {Missing[], 1, 2, 3}

In[3]:= DeleteMissing[a]
Out[3]= DeleteMissing[{Missing[], 1, 2, 3}]

In[4]:= Definition@DeleteMissing
Out[4]= Definition[DeleteMissing]

This looks to be the exact same issue from here:

Please report it to Wolfram Support.

As a workaround, you can turn off the Suggestions Bar by going to Preferences -> Interface and unchecking Show Suggestions Bar After Last Output. After turning off the Suggestions Bar, it is also necessary to Quit and relaunch the kernel for the problem to go away.

$\endgroup$
  • $\begingroup$ If you turn off the suggestions bar after you encountered the problem, you will also have to quit and relaunch the kernel. $\endgroup$ – m_goldberg Jan 29 '15 at 20:38
  • $\begingroup$ @m_goldberg Thank you, updated the answer. $\endgroup$ – Szabolcs Jan 29 '15 at 20:41
  • $\begingroup$ That and this. I guess I should really be shutting down that bar now. $\endgroup$ – Sjoerd C. de Vries Jan 29 '15 at 23:47
3
$\begingroup$

This is an extension to Szabolcs' answer. I would have explained it in 2nd comment to his answer, but it is a little too complicated to be a comment.

There is another complication in regard to reproducing this problem. It is essential that the assignment

a = {Missing[], 1, 2, 3} ;

be evaluated before a DeleteMissing expression is successfully evaluated and the suggestion bar must up come at its completion.

Starting with a freshly loaded kernel, the suggestions bar enabled, and all the code in one cell.

a = {Missing[], 1, 2, 3} ;
DeleteMissing[a]
{1, 2, 3}

will work.

Quitting from and restarting the kernel and making two separate cells.

a = {Missing[], 1, 2, 3} ; (* evaluate this cell first and separately *)

DeleteMissing[a]
DeleteMissing[{Missing[], 1, 2, 3}]

reproduces the OP's problem exactly.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.