Thank you.
I have tried with Sweave but the problem is the R script embedded is working if i run it alone.But when i compile the pdf with the latex and R code it is throwing error.
It seems to be a LaTeX error, not an R error. Did you try to compile the LaTeX part by itself?
Could it be that there is no separation (newline) between the \TextField and chunk or something along these lines (so you're effectively trying to put 3 elements inside a single tabular cell)?
I want the value to be printed to the side of the text like a form.We need to create the form template with all the labels and the corresponding values read from a csv file for each label.
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\SweaveOpts{concordance=TRUE}
You can include the fields without a table:
\noindent
\TextField{Study Name:}
<<echo=FALSE>>=
m <- as.character(1:10)
m.formatted <- paste(m, collapse="|")
print(m)
@
\TextField{Form:}
\vspace{10 mm}
\hrule
\vspace{10 mm}
Or if you want to include it in the table, you can use \verb@\Sexpr@ to include the preformatted text. I don't think you can directly put a code chunk inside a tabular cell, this solution comes from \href{https://latex.org/forum/viewtopic.php?t=8727}{here}.
\begin{tabular}{l}
\TextField{Study Name:}\\
\Sexpr{m.formatted}\\
\TextField{Form:}
\end{tabular}
\end{document}