I am writing a manual for an R file in which expressions like this are common:
lm.1 <- lm(y ~ x1 + x2)
I will be enclosing code samples in a verbatim environment but this doesn't work properly for tildes.
To create the above in single line through LaTeX is quite simple
\[\mathtt{lm.1}\; \verb"<-" \;\mathtt{lm(y \sim x1+x2)}.\]
but creating such a line for each instance of the code where a tilde occurs in that line seems inefficient.
There are ways to propsectively define tildes, but my code is already written. What is the best way to make tildes appear as they do in the R file (or in Notepad etc)?

What is the best way to make tildes appear as they do in the R file (or in Notepad etc)?? I'm thinking the problem is that\simproduces the wrong type of tilde for you. If so look at this question: http://tex.stackexchange.com/questions/312/correctly-typesetting-a-tilde – Mythio Jun 24 '13 at 13:04\simwon't have the desired result. Is there a more efficient way to produce the tilde symbol as displayed in notepad than going through and replacing each instance of~(and remembering to do so in future versions)? – Hugh Jun 24 '13 at 13:09~produces a~in verbatim mode! – Ian Thompson Jun 24 '13 at 13:48