For use with xtable
's add.to.row
when tabular.environment = "longtable"
longtable_head.Rd
Format header information from an xtable for adding to the printed output at position 0.
Usage
longtable_head(
xtab,
add.to.caption = " (continued)",
footnote = "Continued on next page",
double.header = FALSE,
pos = 0
)
Arguments
- xtab
An object of class
xtable
.Text to be added to all but the last captions, default is " (continued)".
- footnote
Text to be added to the footnote of all but the last page, default is "Continued on next page".
- double.header
Logical, does the table have a double header?
- pos
position in table to insert the header commands, default is 0. Use 1 if double header is
TRUE
Examples
xtab <- xtable::xtable(iris, caption = "Iris Data")
xtable::print.xtable(xtab, tabular.environment = "longtable", floating = FALSE,
hline.after = c(-1,0),
add.to.row = longtable_head(xtab))
#> % latex table generated in R 4.4.2 by xtable 1.8-4 package
#> % Tue Jan 28 11:20:38 2025
#> \begin{longtable}{rrrrrl}
#> \hline
#> & Sepal.Length & Sepal.Width & Petal.Length & Petal.Width & Species \\
#> \endfirsthead
#> \caption[]{Iris Data (continued)}\\
#> \hline
#> Sepal.Length & Sepal.Width & Petal.Length & Petal.Width & Species \\
#> \hline
#> \endhead
#> \hline
#> {\footnotesize Continued on next page}
#> \endfoot
#> \endlastfoot
#> \hline
#> 1 & 5.10 & 3.50 & 1.40 & 0.20 & setosa \\
#> 2 & 4.90 & 3.00 & 1.40 & 0.20 & setosa \\
#> 3 & 4.70 & 3.20 & 1.30 & 0.20 & setosa \\
#> 4 & 4.60 & 3.10 & 1.50 & 0.20 & setosa \\
#> 5 & 5.00 & 3.60 & 1.40 & 0.20 & setosa \\
#> 6 & 5.40 & 3.90 & 1.70 & 0.40 & setosa \\
#> 7 & 4.60 & 3.40 & 1.40 & 0.30 & setosa \\
#> 8 & 5.00 & 3.40 & 1.50 & 0.20 & setosa \\
#> 9 & 4.40 & 2.90 & 1.40 & 0.20 & setosa \\
#> 10 & 4.90 & 3.10 & 1.50 & 0.10 & setosa \\
#> 11 & 5.40 & 3.70 & 1.50 & 0.20 & setosa \\
#> 12 & 4.80 & 3.40 & 1.60 & 0.20 & setosa \\
#> 13 & 4.80 & 3.00 & 1.40 & 0.10 & setosa \\
#> 14 & 4.30 & 3.00 & 1.10 & 0.10 & setosa \\
#> 15 & 5.80 & 4.00 & 1.20 & 0.20 & setosa \\
#> 16 & 5.70 & 4.40 & 1.50 & 0.40 & setosa \\
#> 17 & 5.40 & 3.90 & 1.30 & 0.40 & setosa \\
#> 18 & 5.10 & 3.50 & 1.40 & 0.30 & setosa \\
#> 19 & 5.70 & 3.80 & 1.70 & 0.30 & setosa \\
#> 20 & 5.10 & 3.80 & 1.50 & 0.30 & setosa \\
#> 21 & 5.40 & 3.40 & 1.70 & 0.20 & setosa \\
#> 22 & 5.10 & 3.70 & 1.50 & 0.40 & setosa \\
#> 23 & 4.60 & 3.60 & 1.00 & 0.20 & setosa \\
#> 24 & 5.10 & 3.30 & 1.70 & 0.50 & setosa \\
#> 25 & 4.80 & 3.40 & 1.90 & 0.20 & setosa \\
#> 26 & 5.00 & 3.00 & 1.60 & 0.20 & setosa \\
#> 27 & 5.00 & 3.40 & 1.60 & 0.40 & setosa \\
#> 28 & 5.20 & 3.50 & 1.50 & 0.20 & setosa \\
#> 29 & 5.20 & 3.40 & 1.40 & 0.20 & setosa \\
#> 30 & 4.70 & 3.20 & 1.60 & 0.20 & setosa \\
#> 31 & 4.80 & 3.10 & 1.60 & 0.20 & setosa \\
#> 32 & 5.40 & 3.40 & 1.50 & 0.40 & setosa \\
#> 33 & 5.20 & 4.10 & 1.50 & 0.10 & setosa \\
#> 34 & 5.50 & 4.20 & 1.40 & 0.20 & setosa \\
#> 35 & 4.90 & 3.10 & 1.50 & 0.20 & setosa \\
#> 36 & 5.00 & 3.20 & 1.20 & 0.20 & setosa \\
#> 37 & 5.50 & 3.50 & 1.30 & 0.20 & setosa \\
#> 38 & 4.90 & 3.60 & 1.40 & 0.10 & setosa \\
#> 39 & 4.40 & 3.00 & 1.30 & 0.20 & setosa \\
#> 40 & 5.10 & 3.40 & 1.50 & 0.20 & setosa \\
#> 41 & 5.00 & 3.50 & 1.30 & 0.30 & setosa \\
#> 42 & 4.50 & 2.30 & 1.30 & 0.30 & setosa \\
#> 43 & 4.40 & 3.20 & 1.30 & 0.20 & setosa \\
#> 44 & 5.00 & 3.50 & 1.60 & 0.60 & setosa \\
#> 45 & 5.10 & 3.80 & 1.90 & 0.40 & setosa \\
#> 46 & 4.80 & 3.00 & 1.40 & 0.30 & setosa \\
#> 47 & 5.10 & 3.80 & 1.60 & 0.20 & setosa \\
#> 48 & 4.60 & 3.20 & 1.40 & 0.20 & setosa \\
#> 49 & 5.30 & 3.70 & 1.50 & 0.20 & setosa \\
#> 50 & 5.00 & 3.30 & 1.40 & 0.20 & setosa \\
#> 51 & 7.00 & 3.20 & 4.70 & 1.40 & versicolor \\
#> 52 & 6.40 & 3.20 & 4.50 & 1.50 & versicolor \\
#> 53 & 6.90 & 3.10 & 4.90 & 1.50 & versicolor \\
#> 54 & 5.50 & 2.30 & 4.00 & 1.30 & versicolor \\
#> 55 & 6.50 & 2.80 & 4.60 & 1.50 & versicolor \\
#> 56 & 5.70 & 2.80 & 4.50 & 1.30 & versicolor \\
#> 57 & 6.30 & 3.30 & 4.70 & 1.60 & versicolor \\
#> 58 & 4.90 & 2.40 & 3.30 & 1.00 & versicolor \\
#> 59 & 6.60 & 2.90 & 4.60 & 1.30 & versicolor \\
#> 60 & 5.20 & 2.70 & 3.90 & 1.40 & versicolor \\
#> 61 & 5.00 & 2.00 & 3.50 & 1.00 & versicolor \\
#> 62 & 5.90 & 3.00 & 4.20 & 1.50 & versicolor \\
#> 63 & 6.00 & 2.20 & 4.00 & 1.00 & versicolor \\
#> 64 & 6.10 & 2.90 & 4.70 & 1.40 & versicolor \\
#> 65 & 5.60 & 2.90 & 3.60 & 1.30 & versicolor \\
#> 66 & 6.70 & 3.10 & 4.40 & 1.40 & versicolor \\
#> 67 & 5.60 & 3.00 & 4.50 & 1.50 & versicolor \\
#> 68 & 5.80 & 2.70 & 4.10 & 1.00 & versicolor \\
#> 69 & 6.20 & 2.20 & 4.50 & 1.50 & versicolor \\
#> 70 & 5.60 & 2.50 & 3.90 & 1.10 & versicolor \\
#> 71 & 5.90 & 3.20 & 4.80 & 1.80 & versicolor \\
#> 72 & 6.10 & 2.80 & 4.00 & 1.30 & versicolor \\
#> 73 & 6.30 & 2.50 & 4.90 & 1.50 & versicolor \\
#> 74 & 6.10 & 2.80 & 4.70 & 1.20 & versicolor \\
#> 75 & 6.40 & 2.90 & 4.30 & 1.30 & versicolor \\
#> 76 & 6.60 & 3.00 & 4.40 & 1.40 & versicolor \\
#> 77 & 6.80 & 2.80 & 4.80 & 1.40 & versicolor \\
#> 78 & 6.70 & 3.00 & 5.00 & 1.70 & versicolor \\
#> 79 & 6.00 & 2.90 & 4.50 & 1.50 & versicolor \\
#> 80 & 5.70 & 2.60 & 3.50 & 1.00 & versicolor \\
#> 81 & 5.50 & 2.40 & 3.80 & 1.10 & versicolor \\
#> 82 & 5.50 & 2.40 & 3.70 & 1.00 & versicolor \\
#> 83 & 5.80 & 2.70 & 3.90 & 1.20 & versicolor \\
#> 84 & 6.00 & 2.70 & 5.10 & 1.60 & versicolor \\
#> 85 & 5.40 & 3.00 & 4.50 & 1.50 & versicolor \\
#> 86 & 6.00 & 3.40 & 4.50 & 1.60 & versicolor \\
#> 87 & 6.70 & 3.10 & 4.70 & 1.50 & versicolor \\
#> 88 & 6.30 & 2.30 & 4.40 & 1.30 & versicolor \\
#> 89 & 5.60 & 3.00 & 4.10 & 1.30 & versicolor \\
#> 90 & 5.50 & 2.50 & 4.00 & 1.30 & versicolor \\
#> 91 & 5.50 & 2.60 & 4.40 & 1.20 & versicolor \\
#> 92 & 6.10 & 3.00 & 4.60 & 1.40 & versicolor \\
#> 93 & 5.80 & 2.60 & 4.00 & 1.20 & versicolor \\
#> 94 & 5.00 & 2.30 & 3.30 & 1.00 & versicolor \\
#> 95 & 5.60 & 2.70 & 4.20 & 1.30 & versicolor \\
#> 96 & 5.70 & 3.00 & 4.20 & 1.20 & versicolor \\
#> 97 & 5.70 & 2.90 & 4.20 & 1.30 & versicolor \\
#> 98 & 6.20 & 2.90 & 4.30 & 1.30 & versicolor \\
#> 99 & 5.10 & 2.50 & 3.00 & 1.10 & versicolor \\
#> 100 & 5.70 & 2.80 & 4.10 & 1.30 & versicolor \\
#> 101 & 6.30 & 3.30 & 6.00 & 2.50 & virginica \\
#> 102 & 5.80 & 2.70 & 5.10 & 1.90 & virginica \\
#> 103 & 7.10 & 3.00 & 5.90 & 2.10 & virginica \\
#> 104 & 6.30 & 2.90 & 5.60 & 1.80 & virginica \\
#> 105 & 6.50 & 3.00 & 5.80 & 2.20 & virginica \\
#> 106 & 7.60 & 3.00 & 6.60 & 2.10 & virginica \\
#> 107 & 4.90 & 2.50 & 4.50 & 1.70 & virginica \\
#> 108 & 7.30 & 2.90 & 6.30 & 1.80 & virginica \\
#> 109 & 6.70 & 2.50 & 5.80 & 1.80 & virginica \\
#> 110 & 7.20 & 3.60 & 6.10 & 2.50 & virginica \\
#> 111 & 6.50 & 3.20 & 5.10 & 2.00 & virginica \\
#> 112 & 6.40 & 2.70 & 5.30 & 1.90 & virginica \\
#> 113 & 6.80 & 3.00 & 5.50 & 2.10 & virginica \\
#> 114 & 5.70 & 2.50 & 5.00 & 2.00 & virginica \\
#> 115 & 5.80 & 2.80 & 5.10 & 2.40 & virginica \\
#> 116 & 6.40 & 3.20 & 5.30 & 2.30 & virginica \\
#> 117 & 6.50 & 3.00 & 5.50 & 1.80 & virginica \\
#> 118 & 7.70 & 3.80 & 6.70 & 2.20 & virginica \\
#> 119 & 7.70 & 2.60 & 6.90 & 2.30 & virginica \\
#> 120 & 6.00 & 2.20 & 5.00 & 1.50 & virginica \\
#> 121 & 6.90 & 3.20 & 5.70 & 2.30 & virginica \\
#> 122 & 5.60 & 2.80 & 4.90 & 2.00 & virginica \\
#> 123 & 7.70 & 2.80 & 6.70 & 2.00 & virginica \\
#> 124 & 6.30 & 2.70 & 4.90 & 1.80 & virginica \\
#> 125 & 6.70 & 3.30 & 5.70 & 2.10 & virginica \\
#> 126 & 7.20 & 3.20 & 6.00 & 1.80 & virginica \\
#> 127 & 6.20 & 2.80 & 4.80 & 1.80 & virginica \\
#> 128 & 6.10 & 3.00 & 4.90 & 1.80 & virginica \\
#> 129 & 6.40 & 2.80 & 5.60 & 2.10 & virginica \\
#> 130 & 7.20 & 3.00 & 5.80 & 1.60 & virginica \\
#> 131 & 7.40 & 2.80 & 6.10 & 1.90 & virginica \\
#> 132 & 7.90 & 3.80 & 6.40 & 2.00 & virginica \\
#> 133 & 6.40 & 2.80 & 5.60 & 2.20 & virginica \\
#> 134 & 6.30 & 2.80 & 5.10 & 1.50 & virginica \\
#> 135 & 6.10 & 2.60 & 5.60 & 1.40 & virginica \\
#> 136 & 7.70 & 3.00 & 6.10 & 2.30 & virginica \\
#> 137 & 6.30 & 3.40 & 5.60 & 2.40 & virginica \\
#> 138 & 6.40 & 3.10 & 5.50 & 1.80 & virginica \\
#> 139 & 6.00 & 3.00 & 4.80 & 1.80 & virginica \\
#> 140 & 6.90 & 3.10 & 5.40 & 2.10 & virginica \\
#> 141 & 6.70 & 3.10 & 5.60 & 2.40 & virginica \\
#> 142 & 6.90 & 3.10 & 5.10 & 2.30 & virginica \\
#> 143 & 5.80 & 2.70 & 5.10 & 1.90 & virginica \\
#> 144 & 6.80 & 3.20 & 5.90 & 2.30 & virginica \\
#> 145 & 6.70 & 3.30 & 5.70 & 2.50 & virginica \\
#> 146 & 6.70 & 3.00 & 5.20 & 2.30 & virginica \\
#> 147 & 6.30 & 2.50 & 5.00 & 1.90 & virginica \\
#> 148 & 6.50 & 3.00 & 5.20 & 2.00 & virginica \\
#> 149 & 6.20 & 3.40 & 5.40 & 2.30 & virginica \\
#> 150 & 5.90 & 3.00 & 5.10 & 1.80 & virginica \\
#> \hline
#> \caption{Iris Data}
#> \end{longtable}