Aliases: xtableList print.xtableList
Keywords: print
### ** Examples data(mtcars) mtcars <- mtcars[, 1:6] mtcarsList <- split(mtcars, f = mtcars$cyl) attr(mtcarsList, "subheadings") <- paste0("Number of cylinders = ", names(mtcarsList)) attr(mtcarsList, "message") <- c("Line 1 of Message", "Line 2 of Message") xList <- xtableList(mtcarsList) print.xtableList(xList)
% latex table generated in R 4.2.3 by xtable 1.8-4 package % Mon Aug 11 15:54:57 2025 \begin{table}[ht] \centering \begin{tabular}{rrrrrrr} \hline & mpg & cyl & disp & hp & drat & wt \\ \hline \multicolumn{7}{l}{Number of cylinders = 4}\\ Datsun 710 & 22.80 & 4.00 & 108.00 & 93.00 & 3.85 & 2.32 \\ Merc 240D & 24.40 & 4.00 & 146.70 & 62.00 & 3.69 & 3.19 \\ Merc 230 & 22.80 & 4.00 & 140.80 & 95.00 & 3.92 & 3.15 \\ Fiat 128 & 32.40 & 4.00 & 78.70 & 66.00 & 4.08 & 2.20 \\ Honda Civic & 30.40 & 4.00 & 75.70 & 52.00 & 4.93 & 1.61 \\ Toyota Corolla & 33.90 & 4.00 & 71.10 & 65.00 & 4.22 & 1.83 \\ Toyota Corona & 21.50 & 4.00 & 120.10 & 97.00 & 3.70 & 2.46 \\ Fiat X1-9 & 27.30 & 4.00 & 79.00 & 66.00 & 4.08 & 1.94 \\ Porsche 914-2 & 26.00 & 4.00 & 120.30 & 91.00 & 4.43 & 2.14 \\ Lotus Europa & 30.40 & 4.00 & 95.10 & 113.00 & 3.77 & 1.51 \\ Volvo 142E & 21.40 & 4.00 & 121.00 & 109.00 & 4.11 & 2.78 \\ \hline \multicolumn{7}{l}{Number of cylinders = 6}\\ Mazda RX4 & 21.00 & 6.00 & 160.00 & 110.00 & 3.90 & 2.62 \\ Mazda RX4 Wag & 21.00 & 6.00 & 160.00 & 110.00 & 3.90 & 2.88 \\ Hornet 4 Drive & 21.40 & 6.00 & 258.00 & 110.00 & 3.08 & 3.21 \\ Valiant & 18.10 & 6.00 & 225.00 & 105.00 & 2.76 & 3.46 \\ Merc 280 & 19.20 & 6.00 & 167.60 & 123.00 & 3.92 & 3.44 \\ Merc 280C & 17.80 & 6.00 & 167.60 & 123.00 & 3.92 & 3.44 \\ Ferrari Dino & 19.70 & 6.00 & 145.00 & 175.00 & 3.62 & 2.77 \\ \hline \multicolumn{7}{l}{Number of cylinders = 8}\\ Hornet Sportabout & 18.70 & 8.00 & 360.00 & 175.00 & 3.15 & 3.44 \\ Duster 360 & 14.30 & 8.00 & 360.00 & 245.00 & 3.21 & 3.57 \\ Merc 450SE & 16.40 & 8.00 & 275.80 & 180.00 & 3.07 & 4.07 \\ Merc 450SL & 17.30 & 8.00 & 275.80 & 180.00 & 3.07 & 3.73 \\ Merc 450SLC & 15.20 & 8.00 & 275.80 & 180.00 & 3.07 & 3.78 \\ Cadillac Fleetwood & 10.40 & 8.00 & 472.00 & 205.00 & 2.93 & 5.25 \\ Lincoln Continental & 10.40 & 8.00 & 460.00 & 215.00 & 3.00 & 5.42 \\ Chrysler Imperial & 14.70 & 8.00 & 440.00 & 230.00 & 3.23 & 5.34 \\ Dodge Challenger & 15.50 & 8.00 & 318.00 & 150.00 & 2.76 & 3.52 \\ AMC Javelin & 15.20 & 8.00 & 304.00 & 150.00 & 3.15 & 3.44 \\ Camaro Z28 & 13.30 & 8.00 & 350.00 & 245.00 & 3.73 & 3.84 \\ Pontiac Firebird & 19.20 & 8.00 & 400.00 & 175.00 & 3.08 & 3.85 \\ Ford Pantera L & 15.80 & 8.00 & 351.00 & 264.00 & 4.22 & 3.17 \\ Maserati Bora & 15.00 & 8.00 & 301.00 & 335.00 & 3.54 & 3.57 \\ \hline \multicolumn{7}{l}{Line 1 of Message}\\ \multicolumn{7}{l}{Line 2 of Message}\\ \end{tabular} \end{table}
print.xtableList(xList, colnames.format = "multiple")
% latex table generated in R 4.2.3 by xtable 1.8-4 package % Mon Aug 11 15:54:57 2025 \begin{table}[ht] \centering \begin{tabular}{rrrrrrr} \multicolumn{7}{l}{Number of cylinders = 4}\\ \hline & mpg & cyl & disp & hp & drat & wt \\\hline Datsun 710 & 22.80 & 4.00 & 108.00 & 93.00 & 3.85 & 2.32 \\ Merc 240D & 24.40 & 4.00 & 146.70 & 62.00 & 3.69 & 3.19 \\ Merc 230 & 22.80 & 4.00 & 140.80 & 95.00 & 3.92 & 3.15 \\ Fiat 128 & 32.40 & 4.00 & 78.70 & 66.00 & 4.08 & 2.20 \\ Honda Civic & 30.40 & 4.00 & 75.70 & 52.00 & 4.93 & 1.61 \\ Toyota Corolla & 33.90 & 4.00 & 71.10 & 65.00 & 4.22 & 1.83 \\ Toyota Corona & 21.50 & 4.00 & 120.10 & 97.00 & 3.70 & 2.46 \\ Fiat X1-9 & 27.30 & 4.00 & 79.00 & 66.00 & 4.08 & 1.94 \\ Porsche 914-2 & 26.00 & 4.00 & 120.30 & 91.00 & 4.43 & 2.14 \\ Lotus Europa & 30.40 & 4.00 & 95.10 & 113.00 & 3.77 & 1.51 \\ Volvo 142E & 21.40 & 4.00 & 121.00 & 109.00 & 4.11 & 2.78 \\ \hline\\ \multicolumn{7}{l}{Number of cylinders = 6}\\ \hline & mpg & cyl & disp & hp & drat & wt \\\hline Mazda RX4 & 21.00 & 6.00 & 160.00 & 110.00 & 3.90 & 2.62 \\ Mazda RX4 Wag & 21.00 & 6.00 & 160.00 & 110.00 & 3.90 & 2.88 \\ Hornet 4 Drive & 21.40 & 6.00 & 258.00 & 110.00 & 3.08 & 3.21 \\ Valiant & 18.10 & 6.00 & 225.00 & 105.00 & 2.76 & 3.46 \\ Merc 280 & 19.20 & 6.00 & 167.60 & 123.00 & 3.92 & 3.44 \\ Merc 280C & 17.80 & 6.00 & 167.60 & 123.00 & 3.92 & 3.44 \\ Ferrari Dino & 19.70 & 6.00 & 145.00 & 175.00 & 3.62 & 2.77 \\ \hline\\ \multicolumn{7}{l}{Number of cylinders = 8}\\ \hline & mpg & cyl & disp & hp & drat & wt \\\hline Hornet Sportabout & 18.70 & 8.00 & 360.00 & 175.00 & 3.15 & 3.44 \\ Duster 360 & 14.30 & 8.00 & 360.00 & 245.00 & 3.21 & 3.57 \\ Merc 450SE & 16.40 & 8.00 & 275.80 & 180.00 & 3.07 & 4.07 \\ Merc 450SL & 17.30 & 8.00 & 275.80 & 180.00 & 3.07 & 3.73 \\ Merc 450SLC & 15.20 & 8.00 & 275.80 & 180.00 & 3.07 & 3.78 \\ Cadillac Fleetwood & 10.40 & 8.00 & 472.00 & 205.00 & 2.93 & 5.25 \\ Lincoln Continental & 10.40 & 8.00 & 460.00 & 215.00 & 3.00 & 5.42 \\ Chrysler Imperial & 14.70 & 8.00 & 440.00 & 230.00 & 3.23 & 5.34 \\ Dodge Challenger & 15.50 & 8.00 & 318.00 & 150.00 & 2.76 & 3.52 \\ AMC Javelin & 15.20 & 8.00 & 304.00 & 150.00 & 3.15 & 3.44 \\ Camaro Z28 & 13.30 & 8.00 & 350.00 & 245.00 & 3.73 & 3.84 \\ Pontiac Firebird & 19.20 & 8.00 & 400.00 & 175.00 & 3.08 & 3.85 \\ Ford Pantera L & 15.80 & 8.00 & 351.00 & 264.00 & 4.22 & 3.17 \\ Maserati Bora & 15.00 & 8.00 & 301.00 & 335.00 & 3.54 & 3.57 \\ \hline \multicolumn{7}{l}{Line 1 of Message}\\ \multicolumn{7}{l}{Line 2 of Message}\\ \end{tabular} \end{table}