Rmarkdown language

Hi there!

I'm working on a final project for college. I'm using R inside a markdown in order to analyze and create beautiful reports. I would like to know how to change the language so that tables and figures titles appear in Spanish.

\begin{table}[!htbp] \centering
\caption{Estimación MCO}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-3} }
\[-1.8ex]\hline
\hline \[-1.8ex]
& \multicolumn{1}{c}{\textit{Variable dependiente:}} \
\cline{2-2}
\[-1.8ex] & \multicolumn{1}{c}{Consumo eléctrico(kwh)} \
\hline \[-1.8ex]
Salario & 0.001^{} \
& (0.0001) \
Aire acondicionado & -74.837^{
} \
& (5.655) \
Calentador & -118.426^{} \
& (9.799) \
Microondas & -20.442^{
} \
& (4.555) \
Servicio doméstico & -76.980^{} \
& (7.656) \
Miembros del hogar & 7.351^{
} \
& (0.817) \
Laptop & -16.829^{} \
& (5.182) \
Internet & -30.765^{
} \
& (4.018) \
Planta & -1.367 \
& (12.816) \
Inversor & 5.475 \
& (4.356) \
Zona & -20.096^{} \
& (4.467) \
Constante & 376.453^{
} \
& (16.821) \
\hline \[-1.8ex]
Observaciones & \multicolumn{1}{c}{5,568} \
R$^{2} & \multicolumn{1}{c}{0.256} \\ R^{2} ajustado & \multicolumn{1}{c}{0.255} \\ Error residual estándar & \multicolumn{1}{c}{127.783 (gl = 5556)} \\ F estadístico & \multicolumn{1}{c}{174.250^{} (gl = 11; 5556)} \\ \hline \hline \\[-1.8ex] \textit{Nota:} & \multicolumn{1}{r}{^{}p<0.1; ^{}p<0.05; ^{***}p<$0.01} \
\end{tabular}
\end{table}

After using stargazer in my case, the output file produced is actually beautiful but since I'm writing the investigation in Spanish I need the entire document to be in Spanish. When knit, it says ''Table 1: Estimation MCO' but I actually want it in Spanish "Tabla 1: Estimación MCO", how can I achieve this?

I think you need to add

lang : es

to your YAML, but for some reason I get Cuadro 1 when I knit a pdf document.

I don't think this is related to rmarkdown. If the package for table that you use is creating the name you need to look there on how to change it probably.

This is still giving me the wrong "Table" trans but is doing something. Table created with

library(stargazer)
stargazer(attitude)

title: "Stellae"
author: "toucan"
date: "10/12/2021"
output: pdf_document
lang : es

It was a dark and stormy night.

\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}lccccccc}
\[-1.8ex]\hline
\hline \[-1.8ex]
Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Min} & \multicolumn{1}{c}{Pctl(25)} & \multicolumn{1}{c}{Pctl(75)} & \multicolumn{1}{c}{Max} \
\hline \[-1.8ex]
rating & 30 & 64.633 & 12.173 & 40 & 58.8 & 71.8 & 85 \
complaints & 30 & 66.600 & 13.315 & 37 & 58.5 & 77 & 90 \
privileges & 30 & 53.133 & 12.235 & 30 & 45 & 62.5 & 83 \
learning & 30 & 56.367 & 11.737 & 34 & 47 & 66.8 & 75 \
raises & 30 & 64.633 & 10.397 & 43 & 58.2 & 71 & 88 \
critical & 30 & 74.767 & 9.895 & 49 & 69.2 & 80 & 92 \
advance & 30 & 42.933 & 10.289 & 25 & 35 & 47.8 & 72 \
\hline \[-1.8ex]
\end{tabular}
\end{table}

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.