Consider the following :
Cases[list, _?NumberQ]
or
DeleteCases[list, Except[_?NumberQ]]
you could also use :
DeleteCases[list, Except[_?NumericQ]]
Edit
The reason one misuses DeleteCases
is because there are similar constructs which work like this (giving the same result) :
Select[list, NumberQ]
i.e. Select[list, criterion]
picks out elements of the list for which criterion
is True
unlike DeleteCases[list, pattern]
which removes elements of list
that match given a pattern. DeleteCases
is supposed to work with expressions, while Select
works basically with lists, although list can have any head, not only List
.
NumberQ
is a more restictive function than NumericQ
, since the latter gives True
also for symbols like e.g. E
:
Head /@ {E, N[E]}
{Symbol, Real}
{NumberQ[E], NumericQ[E]}
{False, True}