]> git.donarmstrong.com Git - xtable.git/commitdiff
Further changes to xtableFtable.R regarding rotation of text
authordscott <dscott@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sun, 17 Jan 2016 10:26:18 +0000 (10:26 +0000)
committerdscott <dscott@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sun, 17 Jan 2016 10:26:18 +0000 (10:26 +0000)
git-svn-id: svn://scm.r-forge.r-project.org/svnroot/xtable@98 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

pkg/R/xtableFtable.R
pkg/vignettes/xtableGallery.Rnw

index fd32d116c4859241170dc5e287d015800cc5edfa..46c7f7b8d482c1a880a6f6415b600380ad790444 100644 (file)
@@ -113,23 +113,30 @@ print.xtableFtable <- function(x,
     attr(fmtFtbl, "caption") <- caption
     attr(fmtFtbl, "label") <- label
     ## if method is "compact", rotate both if either requested
-    if (method == "compact"){
-      if (rotate.rownames) rotate.colnames <- TRUE
-      if (rotate.colnames) rotate.rownames <- TRUE
-    }
+    ## if (method == "compact"){
+    ##   if (rotate.rownames) rotate.colnames <- TRUE
+    ##   if (rotate.colnames) rotate.rownames <- TRUE
+    ## }
 
     ## rotations are possible
     if (rotate.rownames){
-      fmtFtbl[nCharRows, 1:(nCharCols - 1)] <-
+      fmtFtbl[1:dim(fmtFtbl)[1], 1:(nCharCols - 1)] <-
         paste0("\\begin{sideways} ",
-               fmtFtbl[nCharRows, 1:(nCharCols - 1)],
+               fmtFtbl[1:dim(fmtFtbl)[1], 1:(nCharCols - 1)],
                "\\end{sideways}")
     }
     if (rotate.colnames){
-      fmtFtbl[1:(nCharRows), nCharCols - 1] <-
-        paste0("\\begin{sideways} ",
-               fmtFtbl[1:(nCharRows), nCharCols - 1],
-               "\\end{sideways}")
+      if (rotate.rownames){
+        fmtFtbl[1:(nCharRows), (nCharCols):dim(fmtFtbl)[2]] <-
+          paste0("\\begin{sideways} ",
+                 fmtFtbl[1:(nCharRows), (nCharCols):dim(fmtFtbl)[2]],
+                 "\\end{sideways}")
+      } else {
+        fmtFtbl[1:(nCharRows), 1:dim(fmtFtbl)[2]] <-
+          paste0("\\begin{sideways} ",
+                 fmtFtbl[1:(nCharRows), 1:dim(fmtFtbl)[2]],
+                 "\\end{sideways}")
+      }
     }
 
 
index 807e8f672d6b8fac2abac122b4b602d708dc02ac..721b78ea7dc881ab4fce161389a8565946e63a75 100644 (file)
@@ -156,7 +156,8 @@ print.xtableFtable(xftbl)
 \p\r
 <<ftable2, results = 'asis'>>=\r
 xftbl <- xtableFtable(tbl, method = "row.compact")\r
-print.xtableFtable(xftbl, rotate.colnames = TRUE)\r
+print.xtableFtable(xftbl, rotate.colnames = TRUE,\r
+                   rotate.rownames = TRUE)\r
 @ %def\r
 \r
 \p\r