# passing string from R to href in rnw file

I would like to pass a string from R script in order to run href in my rnw file. In the R script I have to include double \\ for the href otherwise I get error.

ifelse(is.na(url_ui_1)|is.null(url_ui_1)|url_ui_1=="",
ui_string<-"",
ui_string<-paste0("\\\\href{",url_ui_1,"}{ here}")
)


In the nrw file I pick up ui_string1 but as the string has \ it errors on me. Is there anyway to pass single \ so that the href code works?

\documentclass[11pt,a4paper, titlepage]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{tikz,Sweave,fancyvrb}
\usepackage{helvet}%font
\usepackage{color}
\def\uistring{ui_string}
\renewcommand{\familydefault}{\sfdefault}%sets fonts across document
\title{}
\date{}
\begin{document}
\SweaveOpts{concordance=TRUE}
\fcolorbox{white}{green!65}{%
\parbox{13cm}{

• In any case, first you need to remove the double \ that you have at the end of your latex file. That part will certainly produce an error. Since you are finishing a paragraph when there is no line to end. – Alex Recuenco Dec 11 '17 at 11:54