0

In a Sweave file written with knitr and Rstudio, as the R code line is long and automatically split in the line under, an error is reported. The problematic line in my code showed bellow is the line 6 Does someone how to proceed ? I think that a little sign is simply needed, but I didn't find the answer on the web.

\begin{tabular}{@{}lr@{}} \toprule
Caracteristics & n, \% \\ \midrule
sexe (male) & \Sexpr{round(((prop.table(table(sexe)))[1]),2)*100} \%\\ 
Mean age at surgery (years) & \Sexpr{round(mean(agediag),1)} $\pm$        \Sexpr{round(sd(agediag),1)}\\
Main onset clinical sign & \\
\hspace{0.5cm} Motor deficit and dysphasia & \Sexpr{table(signeclinrevel)[1]}\\,  \Sexpr{formatPercent(prop.table(table(signeclinrevel))[1])}\\
\hspace{0.5cm} Seizure &   \\
\hspace{0.5cm} Cognitive disorders & \\
\hspace{0.5cm} Others (intracranial hypertension, eyesight troubles…) & \\
Alexis Pigeon
  • 7,423
  • 11
  • 39
  • 44
CharlesLDN
  • 169
  • 1
  • 9
  • Hi and Welcome to stackoverflow! As you are new on SO, please take some time to read [about Stackoverflow](http://stackoverflow.com/about) and [how to ask](http://meta.stackoverflow.com/help/how-to-ask). You are much more likely to receive a helpful answer if you provide a [minimal, reproducible data set](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) together with the code you have tried. Also add the error message. Thanks! – Henrik Oct 07 '13 at 23:54

1 Answers1

0

The answer is that the the function formatPercent from the package reporttools doesn't work in Latex table. Instead this work:

    \hspace{0.5cm} Motor deficit and dysphasia & \Sexpr{table(signeclinrevel)[1]}, (\Sexpr{round((prop.table(table(signeclinrevel))[1]*100),1)} \%)\\
CharlesLDN
  • 169
  • 1
  • 9