-1

I'm rendering a table using apa_table() function of papaja package with success. When I used this function in the past (months ago) I was able to use latex special characters to custom the rendering.

However, it seems that the function now overwrite the initial character strings to render its exact content in latex format.

table <- data.frame(c(1,1),c(2,2))
colnames(table)<-c("$Var1$","Var2")

library(papaja)

cat(apa_table(table))

I got this output :

\begin{table}[tbp]

\begin{center}
\begin{threeparttable}

\begin{tabular}{ll}
\toprule
\$Var1\$ & \multicolumn{1}{c}{Var2}\\
\midrule
1.00 & 2.00\\
1.00 & 2.00\\
\bottomrule
\end{tabular}

\end{threeparttable}
\end{center}

\end{table}

I would like to get $Var1$ instead of \$Var1\$ for it will be rendered by markdown as Var1 instead of $Var1$

Is there a way to escape this and to make full use of the latex language with apa_table ?

Thank you very much =)

Kyabdro
  • 75
  • 5
  • You should include a minimal example that people can use to reproduce the problem. It should be completely self-contained so we can just run it and see the issue. – user2554330 Jun 30 '20 at 13:07
  • I've edited my question, thank you for telling me. – Kyabdro Jun 30 '20 at 13:34

1 Answers1

2

You just need to add escape = FALSE to the arguments to apa_table(table), i.e. use

cat(apa_table(table, escape = FALSE))

This means that no escapes will be added, so if you really want to include something like a dollar sign, you'll need to escape it yourself.

By the way, the papaja package isn't on CRAN: this isn't a good sign about its reliability. Currently you need this to install it:

remotes::install_github("crsh/papaja")
user2554330
  • 37,248
  • 4
  • 43
  • 90