]> git.donarmstrong.com Git - xtable.git/commitdiff
Fixed bugs #6907 and #6260
authordscott <dscott@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Tue, 12 Jan 2016 01:32:32 +0000 (01:32 +0000)
committerdscott <dscott@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Tue, 12 Jan 2016 01:32:32 +0000 (01:32 +0000)
git-svn-id: svn://scm.r-forge.r-project.org/svnroot/xtable@90 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

pkg/NEWS
pkg/R/print.xtable.R

index 4d24a5e1daddbcc3acf3f73bd64fccde83916013..9687f7d840fcf0ab31ee18bc6ac4a861a3f2a3cf 100644 (file)
--- a/pkg/NEWS
+++ b/pkg/NEWS
   * Added option to produce math style exponents when sanitizing
     numbers, as suggested by Don Armstrong (don@donarmstrong.com), who
     also provided code
+  * Fixed bug #6907. Warning was created when the data frame as no
+    rows for type is 'html'. Added a test to create the matrix
+    requested specially in that case. Original code was
+    BTD2 <- matrix(align.tmp[(2-pos):(ncol(x)+1)],
+                   nrow = nrow(x), ncol = ncol(x)+pos, byrow = TRUE)
+    which created a matrix with no rows, but gave a warning when
+    there were no rows in the data frame being processed.
+  * Fixed bug #6260. Accepted the change suggested by Claudius
+    Loehnert, which was to replace { and } by \begingroup and
+    \endgroup respectively as the delimiters when size was to changed
+    in a table.
 
 
 1.8-0
index b3b4b9a4178eb834021257cc0efbccd0160eb852..ce9c7bc52d0cae77f0f0860d9655b21012f0e4dd 100644 (file)
@@ -334,8 +334,11 @@ print.xtable <- function(x,
       if(length(grep("^\\\\", size)) == 0){\r
         size <- paste("\\", size, sep = "")\r
       }\r
-      BSIZE <- paste("{", size, "\n", sep = "")\r
-      ESIZE <- "}\n"\r
+      ## Change suggested by Claudius Loehnert reported in Bug #6260\r
+      ## BSIZE <- paste("{", size, "\n", sep = "")\r
+      ## ESIZE <- "{\n"\r
+      BSIZE <- paste("\\begingroup", size, "\n", sep = "")\r
+      ESIZE <- "\\endgroup\n"\r
     }\r
     BLABEL <- "\\label{"\r
     ELABEL <- "}\n"\r
@@ -386,8 +389,12 @@ print.xtable <- function(x,
       BTD1 <- " <td align=\""\r
       align.tmp <- attr(x, "align", exact = TRUE)\r
       align.tmp <- align.tmp[align.tmp!="|"]\r
-      BTD2 <- matrix(align.tmp[(2-pos):(ncol(x)+1)],\r
-                     nrow = nrow(x), ncol = ncol(x)+pos, byrow = TRUE)\r
+      if (nrow(x) == 0) {\r
+        BTD2 <- matrix(nrow = 0, ncol = ncol(x)+pos)\r
+      } else {\r
+        BTD2 <- matrix(align.tmp[(2-pos):(ncol(x)+1)],\r
+                       nrow = nrow(x), ncol = ncol(x)+pos, byrow = TRUE)\r
+      }\r
       ## Based on contribution from Jonathan Swinton <jonathan@swintons.net>\r
       ## in e-mail dated Wednesday, January 17, 2007\r
       BTD2[regexpr("^p", BTD2)>0] <- "left"\r