# R assignment operator ("<-")

How does one typeset the R assignment operator ("<-")? Workarounds such as

\begin{description}
\item[x \textless{}- c(1:3)] Create the vector [1 2 3] and assign it to an object named x.  %Illustrates workaround 1.
\item[y $\leftangle$- c(10.4, 5.6, 3.1)] Create the vector [10.4 5.6 3.1] and assign it to an object named y.  %Illustrates workaround 2.
\item[z $\leftarrow$ c(3.1, 6.4, 21.7)] Create the vector [3.1 6.4 21.7] and assign it to an object named z.  %Illustrates workaround 3.
\end{description}


are less than satisfactory.

• Is \texttt{<-} enough for you? Apr 5, 2014 at 18:02
• Welcome to TeX.SX! I'd say \item[\texttt{x <- c(1:3)}] to underline the fact it's code. Also [1 2 3] might be $\begin{bmatrix} 1 & 2 & 3\end{bmatrix}$ because it's math. Apr 5, 2014 at 18:04
• You could also use $\leftarrow$ or $\Leftarrow$ if you want something prettier. Apr 5, 2014 at 20:14
• It looks much better if you make the whole assignment into a math formula. \item[$y \gets c(1,2,3)$] blah blah.... Apr 5, 2014 at 21:18

The sequence $\gets$ would do the trick.