I have a function named log_prior(...) and I don't want the 'log_' highlighted, here's what I tried
\documentclass{article}
\usepackage{listings}
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{frame=tb,
language=R,
keywordstyle=\color{blue},
numberstyle=\tiny\color{gray},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
alsoletter ={_},
otherkeywords = {!,!=,~,\$,*,\&,\%/\%,\%*\%,\%\%,<<-},
breaklines=true,
breakatwhitespace=true,
tabsize=3
}
\begin{document}
\begin{lstlisting}[language=R]
log_prior <- function(th){
....
}
\end{lstlisting}
\end{document}

\begin{lstlisting}[language=R]and replace it with\begin{lstlisting}. See alsodeletekeywords={}. http://tex.stackexchange.com/a/164189/124842. – Bobyandbob Feb 27 '17 at 10:16