Consider the topological spaces $X$ with the following property:
For every compact $K\subseteq X$ there is a compact set $L$ such that $K\subseteq L\subseteq X$ and $L$ is a retract of $X$.
Let us call this property RBC (Retract to a Bigger Compact). This property seems natural and useful, but I have been unable to find anything directly on it.
Using certain known results, itIt is not hard to see that everythe following is true:
Proposition 1: Every closed convex topological subspace $C$ of a locally convex metrizable topological vector space $V$ has the RBC property.
Details on Proposition 1: Take any nonempty compact $K\subseteq C$. Then, by known results (note, in particular, Ref. [7] there), the closed topological subspaceconvex hull $L:=\overline{\text{conv}\,K}$ of $K$ in $V$ is a locally convex metrizable topological vector spaceretract of $V$. Since $L\subseteq C\subseteq V$, it follows that $L$ is a retract of $C$. Since $K$ is compact, $L$ is also compact, and of course $K\subseteq L\subseteq C$. Thus, $C$ has the RBC property. $\Box$
It is also clear that the RBC property is topological and thus invariant with respect to homeomorphisms. Trvially, any compact topological space has the RBC property.
Question: Can one characterize the RBC property?
That is, can one give a usable necessary and sufficient condition for it? Or a usable sufficient condition somewhat close to necessity? By "usable", I mean without the quantifier "there is" in the definition of the RBC property.
I do not know the answer even to this question: Is there an example of a topological space without the RBC property?
Thinking about the latter question, I have in mind the "non-retract" example of the $(n-1)$-sphere, which is compact but not a retract of the corresponding closed ball, whereas the ball is compact as well and of course is a retract of itself and of the corresponding $n$-space.
Update: The latter question has been answered in comments by erz, Anonymous, and Taras Banakh, who provided examples of topological spaces without the RBC property.
At this point, I would like to make the first question, to characterize the RBC property, more specific:
Specific question: Is it true that all Polish spaces have the RBC property?
My motivation for all these questions comes from probability. Indeed, any retraction $r$ from $X$ to a compact subset $K$ of $X$ naturally induces the truncation map $\xi\mapsto r\circ\xi$ of random elements $\xi$ of $X$, so that the truncated version $r\circ\xi$ of $\xi$ is a random element of the compact set $K$. Moreover, this truncation map is continuous: if $\xi_t\to\xi$ in distribution, then $r\circ\xi_t\to r\circ\xi$ in distribution.
Update 2: Following the latest comment by Anonymous, I have found a recent paper by Lipham, where on the first page one finds an example of a connected completely metrizable space which has no compact connected subset of cardinality greater than one, and therefore does not have the RBC property. By Mazurkiewicz's theorem, this space is also separable and hence Polish. Thus, it is not true that all Polish spaces have the RBC property.