Is there an injective function defined in $\mathbb{R}$ with $[0,1]$ as its image

functions

I know that there are injective functions from $\mathbb{R}$ to $(0,1)$ that take all the values in $(0,1)$ for one $x$ (that is, with image $(0,1)$). For example this one:

$$f(x)=\frac{e^x}{e^x+1}, \ \ x\in\mathbb{R}$$

But I can't think of an injective function defined in $\mathbb{R}$ that has $[0,1]$ as its image. Does such a function exist and if not, why?

Best Answer

Maybe this function will work

$f(x)=\frac{1}{2}+\frac{\arctan x}{\pi}$ if $x\notin\mathbb N$

$f(1)=0$, $f(2)=1$ and $f(n+2)=\frac{1}{2}+\frac{\arctan n}{\pi}$ for $n\in\mathbb N$