Langtabelle und Farbtabelle

Langtabelle und Farbtabelle

Ich versuche, bestimmte Zeilen (mit MES >= 8) einzufärben, aber aus irgendeinem Grund funktioniert es für die erste Zeile nicht. Ich führe ein R Markdown aus (xtable-Paket zum Erstellen der Tabelle).

print(xtable(m8.c(SC), digits = 0, caption = "Atendimentos superados (\\%)"),     add.to.row = list(list(which(m8.c(SC)$MES >= 8)-1), "\\rowcolor{red} "), tabular.environment = "longtable")

Der mit xtable generierte Code ist

% latex table generated in R 3.3.1 by xtable 1.8-2 package
% Wed Feb 01 15:37:07 2017
\begin{longtable}{rrlrrrrrrr}
  \hline
 & CIDADE1 & UOR & MODAL & MES & Atend & Valor & AtSup & Turmas & TurAcu \\ 
  \rowcolor{red}  \hline
    1 & 1 & C. A. FLORIANÓPOLIS & 2 & 8 & 2725 & 2540 & 7 & 14 & 28 \\ 
   \rowcolor{red} 2 & 1 & C. A. FLORIANÓPOLIS & 2 & 10 & 2161 & 2126 & 2 & 0 & 28 \\ 
   \rowcolor{red} 3 & 4 & C. A. BRUSQUE & 1 & 11 & 30 & 27 & 11 & 1 & 2 \\ 
  4 & 9 & C. A. CRICIÚMA & 1 & 6 & 4648 & 2565 & 81 & 0 & 4 \\ 
   \rowcolor{red} 5 & 9 & C. A. CRICIÚMA & 1 & 8 & 1827 & 1399 & 31 & 0 & 7 \\ 
   \rowcolor{red} 6 & 9 & C. A. CRICIÚMA & 1 & 9 & 1596 & 1314 & 21 & 0 & 7 \\ 
   \rowcolor{red} 7 & 9 & C. A. CRICIÚMA & 1 & 10 & 1196 & 1166 & 3 & 0 & 7 \\ 
   \rowcolor{red} 8 & 9 & C. A. CRICIÚMA & 1 & 11 & 1191 & 926 & 29 & 0 & 7 \\ 
  9 & 9 & C. A. CRICIÚMA & 1 & 6 & 233 & 120 & 94 & 1 & 2 \\ 
   \rowcolor{red} 10 & 9 & C. A. CRICIÚMA & 1 & 8 & 144 & 72 & 100 & 0 & 2 \\ 
   \rowcolor{red} 11 & 9 & C. A. CRICIÚMA & 1 & 9 & 157 & 81 & 94 & 0 & 2 \\ 
   \rowcolor{red} 12 & 9 & C. A. CRICIÚMA & 1 & 10 & 120 & 80 & 50 & 0 & 2 \\ 
   \rowcolor{red} 13 & 9 & C. A. CRICIÚMA & 1 & 11 & 203 & 108 & 88 & 0 & 2 \\ 
  14 & 9 & C. A. CRICIÚMA & 1 & 6 & 265 & 144 & 84 & 1 & 2 \\ 
   \rowcolor{red} 15 & 9 & C. A. CRICIÚMA & 1 & 8 & 179 & 60 & 198 & 1 & 3 \\ 
  \rowcolor{red} 16 & 9 & C. A. CRICIÚMA & 1 & 9 & 120 & 69 & 74 & 0 & 3 \\ 
   \rowcolor{red} 17 & 9 & C. A. CRICIÚMA & 1 & 10 & 120 & 43 & 179 & 0 & 3 \\ 
   \rowcolor{red} 18 & 9 & C. A. CRICIÚMA & 1 & 11 & 116 & 43 & 170 & 0 & 3 \\ 
   \rowcolor{red} 19 & 9 & C. A. CRICIÚMA & 1 & 8 & 228 & 120 & 90 & 0 & 4 \\ 
   \rowcolor{red} 20 & 9 & C. A. CRICIÚMA & 1 & 9 & 168 & 96 & 75 & 0 & 4 \\ 
   \rowcolor{red} 21 & 9 & C. A. CRICIÚMA & 1 & 10 & 129 & 90 & 43 & 0 & 4 \\ 
   \rowcolor{red} 22 & 9 & C. A. CRICIÚMA & 1 & 11 & 152 & 78 & 95 & 0 & 4 \\ 
  23 & 9 & C. A. CRICIÚMA & 1 & 7 & 55 & 52 & 6 & 1 & 3 \\ 
   \rowcolor{red} 24 & 9 & C. A. CRICIÚMA & 1 & 8 & 112 & 40 & 180 & 0 & 3 \\ 
   \rowcolor{red} 25 & 9 & C. A. CRICIÚMA & 1 & 9 & 74 & 32 & 131 & 0 & 3 \\ 
   \rowcolor{red} 26 & 9 & C. A. CRICIÚMA & 1 & 10 & 98 & 35 & 180 & 0 & 3 \\ 
   \rowcolor{red} 27 & 9 & C. A. CRICIÚMA & 1 & 11 & 84 & 28 & 200 & 0 & 3 \\ 
  28 & 9 & C. A. CRICIÚMA & 2 & 7 & 642 & 408 & 57 & 5 & 11 \\ 
   \rowcolor{red} 29 & 9 & C. A. CRICIÚMA & 2 & 8 & 814 & 522 & 56 & 0 & 11 \\ 
   \rowcolor{red} 30 & 9 & C. A. CRICIÚMA & 2 & 9 & 663 & 444 & 49 & 1 & 12 \\ 
   \rowcolor{red} 31 & 9 & C. A. CRICIÚMA & 2 & 10 & 690 & 483 & 43 & 0 & 12 \\ 
   \rowcolor{red} 32 & 9 & C. A. CRICIÚMA & 2 & 11 & 651 & 434 & 50 & 0 & 12 \\ 
   \rowcolor{red} 33 & 9 & C. A. CRICIÚMA & 2 & 8 & 78 & 45 & 73 & 0 & 2 \\ 
   \rowcolor{red} 34 & 9 & C. A. CRICIÚMA & 2 & 10 & 31 & 18 & 72 & 0 & 2 \\ 
   \rowcolor{red} 35 & 9 & C. A. CRICIÚMA & 2 & 11 & 34 & 18 & 89 & 0 & 2 \\ 
  36 & 13 & C. A. LAGES & 2 & 4 & 684 & 672 & 2 & 0 & 4 \\ 
  37 & 13 & C. A. LAGES & 4 & 7 & 72 & 60 & 20 & 0 & 3 \\ 
   \rowcolor{red} 38 & 13 & C. A. LAGES & 4 & 8 & 99 & 54 & 83 & 1 & 4 \\ 
   \rowcolor{red} 39 & 13 & C. A. LAGES & 4 & 9 & 81 & 79 & 3 & 0 & 4 \\ 
  \rowcolor{red} 40 & 13 & C. A. LAGES & 4 & 10 & 66 & 63 & 5 & 0 & 4 \\ 
   \rowcolor{red} 41 & 13 & C. A. LAGES & 4 & 11 & 69 & 63 & 10 & 0 & 4 \\ 
   \rowcolor{red} 42 & 13 & C. A. LAGES & 4 & 8 & 93 & 76 & 22 & 0 & 3 \\ 
   \rowcolor{red} 43 & 13 & C. A. LAGES & 4 & 9 & 108 & 95 & 14 & 0 & 3 \\ 
   \rowcolor{red} 44 & 13 & C. A. LAGES & 4 & 10 & 93 & 76 & 22 & 0 & 3 \\ 
   \rowcolor{red} 45 & 13 & C. A. LAGES & 4 & 11 & 90 & 76 & 18 & 0 & 3 \\ 
   \rowcolor{red} 46 & 13 & C. A. LAGES & 4 & 8 & 96 & 60 & 60 & 1 & 4 \\ 
   \rowcolor{red} 47 & 13 & C. A. LAGES & 4 & 9 & 99 & 82 & 21 & 0 & 4 \\ 
   \rowcolor{red} 48 & 13 & C. A. LAGES & 4 & 10 & 81 & 66 & 23 & 0 & 4 \\ 
   \rowcolor{red} 49 & 13 & C. A. LAGES & 4 & 11 & 78 & 66 & 18 & 0 & 4 \\ 
  50 & 14 & C. A. LAGUNA & 1 & 7 & 1127 & 594 & 90 & 0 & 4 \\ 
   \rowcolor{red} 51 & 14 & C. A. LAGUNA & 1 & 8 & 1677 & 1488 & 13 & 1 & 5 \\ 
   \rowcolor{red} 52 & 14 & C. A. LAGUNA & 1 & 9 & 1443 & 1408 & 2 & 0 & 5 \\ 
   \rowcolor{red} 53 & 14 & C. A. LAGUNA & 1 & 10 & 656 & 624 & 5 & 0 & 5 \\ 
   \rowcolor{red} 54 & 17 & C. A. XANXERÊ & 2 & 10 & 434 & 433 & 0 & 0 & 3 \\ 
   \rowcolor{red} 55 & 18 & C. A. JARAGUÁ DO SUL & 4 & 9 & 180 & 99 & 82 & 1 & 2 \\ 
  56 & 32 & C. A. URUBICI & 2 & 3 & 563 & 562 & 0 & 1 & 4 \\ 
   \hline
\hline
\caption{Atendimentos superados (\%)} 
\end{longtable}

Und hier ist ein Bild des Ergebnisses.

Tabelle

Irgendwelche Vorschläge, um das Problem zu beheben?

Antwort1

Bitte posten Sie immer vollständige Dokumente wie unten, nicht nur Fragmente. Es \rowcolormuss aber nach dem stehen \hline.

Bildbeschreibung hier eingeben

\documentclass{article}

\usepackage{longtable,colortbl}

\begin{document}

% Wed Feb 01 15:37:07 2017
\begin{longtable}{rrlrrrrrrr}
  \hline
 & CIDADE1 & UOR & MODAL & MES & Atend & Valor & AtSup & Turmas & TurAcu \\ 
\hline
  \rowcolor{red}  
    1 & 1 & C. A. FLORIANÓPOLIS & 2 & 8 & 2725 & 2540 & 7 & 14 & 28 \\ 
   \rowcolor{red} 2 & 1 & C. A. FLORIANÓPOLIS & 2 & 10 & 2161 & 2126 & 2 & 0 & 28 \\ 
   \rowcolor{red} 3 & 4 & C. A. BRUSQUE & 1 & 11 & 30 & 27 & 11 & 1 & 2 \\ 
  4 & 9 & C. A. CRICIÚMA & 1 & 6 & 4648 & 2565 & 81 & 0 & 4 \\ 
   \rowcolor{red} 5 & 9 & C. A. CRICIÚMA & 1 & 8 & 1827 & 1399 & 31 & 0 & 7 \\ 
   \rowcolor{red} 6 & 9 & C. A. CRICIÚMA & 1 & 9 & 1596 & 1314 & 21 & 0 & 7 \\ 
   \rowcolor{red} 7 & 9 & C. A. CRICIÚMA & 1 & 10 & 1196 & 1166 & 3 & 0 & 7 \\ 
   \rowcolor{red} 8 & 9 & C. A. CRICIÚMA & 1 & 11 & 1191 & 926 & 29 & 0 & 7 \\ 
  9 & 9 & C. A. CRICIÚMA & 1 & 6 & 233 & 120 & 94 & 1 & 2 \\ 
   \hline
\hline
\caption{Atendimentos superados (\%)} 
\end{longtable}



\end{document}

verwandte Informationen