]> git.donarmstrong.com Git - xtable.git/commitdiff
Changed functions dealing with mathematical arrays and lists from xtable methods...
authordscott <dscott@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Thu, 24 Dec 2015 10:26:56 +0000 (10:26 +0000)
committerdscott <dscott@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Thu, 24 Dec 2015 10:26:56 +0000 (10:26 +0000)
git-svn-id: svn://scm.r-forge.r-project.org/svnroot/xtable@78 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

pkg/NAMESPACE
pkg/R/print.xtableList.R [deleted file]
pkg/R/print.xtableMatharray.R [deleted file]
pkg/R/xtable.R
pkg/R/xtableList.R [new file with mode: 0644]
pkg/R/xtableMatharray.R [new file with mode: 0644]
pkg/man/print.xtableMatharray.Rd
pkg/man/xtable-internal.Rd
pkg/man/xtable.Rd
pkg/tests/test.matharray.R
pkg/vignettes/listOfTablesGallery.Rnw

index 92f5928c2bae2be1e22359a88465f6df8b30b30a..e316a48eea5a03e27394015da8bb7b5437e6e01c 100644 (file)
@@ -4,7 +4,8 @@ importFrom("stats", "anova", "as.ts", "cycle", "end", "frequency",
 importFrom("utils", "packageDescription")
 export("caption<-", "caption", "label", "label<-",
        "align<-", "align", "digits<-", "digits", "display<-",
-       "display", "xtable", "xtable.xtableList", "xtable.lsmeans",
+       "display", "xtable",
+       "xtableMatharray","xtableList", "xtablelsmeans",
        "print.xtable", "print.xtableMatharray", "print.xtableList",
        "toLatex.xtable",
        "autoformat", "xalign", "xdigits", "xdisplay")
@@ -27,8 +28,6 @@ S3method("display", "xtable")
 
 S3method("xtable", "data.frame")
 S3method("xtable", "matrix")
-S3method("xtable", "xtableMatharray")
-S3method("xtable", "xtableList")
 S3method("xtable", "table")
 S3method("xtable", "anova")
 S3method("xtable", "aov")
@@ -44,4 +43,3 @@ S3method("xtable", "summary.prcomp")
 S3method("xtable", "coxph")
 S3method("xtable", "ts")
 S3method("xtable", "zoo")
-S3method("xtable", "lsmeans")
diff --git a/pkg/R/print.xtableList.R b/pkg/R/print.xtableList.R
deleted file mode 100644 (file)
index 30139c7..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-print.xtableList <- function(x,\r
-  type = getOption("xtable.type", "latex"),\r
-  file = getOption("xtable.file", ""),\r
-  append = getOption("xtable.append", FALSE),\r
-  floating = getOption("xtable.floating", TRUE),\r
-  floating.environment = getOption("xtable.floating.environment", "table"),\r
-  table.placement = getOption("xtable.table.placement", "ht"),\r
-  caption.placement = getOption("xtable.caption.placement", "bottom"),\r
-  caption.width = getOption("xtable.caption.width", NULL),\r
-  latex.environments = getOption("xtable.latex.environments", c("center")),\r
-  tabular.environment = getOption("xtable.tabular.environment", "tabular"),\r
-  size = getOption("xtable.size", NULL),\r
-  hline.after = NULL,\r
-  NA.string = getOption("xtable.NA.string", ""),\r
-  include.rownames = getOption("xtable.include.rownames", TRUE),\r
-  include.colnames = getOption("xtable.include.colnames", TRUE),\r
-  only.contents = getOption("xtable.only.contents", FALSE),\r
-  add.to.row = NULL,\r
-  sanitize.text.function = getOption("xtable.sanitize.text.function", NULL),\r
-  sanitize.rownames.function = getOption("xtable.sanitize.rownames.function",\r
-                                         sanitize.text.function),\r
-  sanitize.colnames.function = getOption("xtable.sanitize.colnames.function",\r
-                                         sanitize.text.function),\r
-  math.style.negative = getOption("xtable.math.style.negative", FALSE),\r
-  html.table.attributes = getOption("xtable.html.table.attributes", "border=1"),\r
-  print.results = getOption("xtable.print.results", TRUE),\r
-  format.args = getOption("xtable.format.args", NULL),\r
-  rotate.rownames = getOption("xtable.rotate.rownames", FALSE),\r
-  rotate.colnames = getOption("xtable.rotate.colnames", FALSE),\r
-  booktabs = getOption("xtable.booktabs", FALSE),\r
-  scalebox = getOption("xtable.scalebox", NULL),\r
-  width = getOption("xtable.width", NULL),\r
-  comment = getOption("xtable.comment", TRUE),\r
-  timestamp = getOption("xtable.timestamp", date()),\r
-  colnames.format = "single",\r
-  ...)\r
-{\r
-  ## Get number of rows for each table in list of tables\r
-  if (booktabs){\r
-    tRule <- "\\toprule"\r
-    mRule <- "\\midrule"\r
-    bRule <- "\\bottomrule"\r
-  } else {\r
-    tRule <- "\\hline"\r
-    mRule <- "\\hline"\r
-    bRule <- "\\hline"\r
-  }\r
-  nCols <- dim(x[[1]])[2]\r
-  rowNums <- sapply(x, dim)[1,]\r
-  combinedRowNums <- cumsum(rowNums)\r
-  combined <- do.call(rbind, x)\r
-  if (colnames.format == "single"){\r
-    add.to.row <- list(pos = NULL, command = NULL)\r
-    add.to.row$pos <- as.list(c(0, combinedRowNums[-length(x)],\r
-                                dim(combined)[1]))\r
-    command <- sapply(x, attr, "subheading")\r
-\r
-    add.to.row$command[1:length(x)] <-\r
-      paste0(mRule,"\n\\multicolumn{", nCols, "}{l}{", command, "}\\\\\n")\r
-    if ( (booktabs) & length(attr(x, "message") > 0) ){\r
-      attr(x, "message")[1] <-\r
-        paste0("\\rule{0em}{2.5ex}", attr(x, "message")[1])\r
-    }\r
-    add.to.row$command[length(x) + 1] <-\r
-      paste0("\n\\multicolumn{", nCols, "}{l}{", attr(x, "message"), "}\\\\\n",\r
-             collapse = "")\r
-    add.to.row$command[length(x) + 1] <-\r
-      paste0(bRule, add.to.row$command[length(x) + 1])\r
-\r
-    class(combined) <- c("xtableList", "data.frame")\r
-    hline.after <- c(-1)\r
-    include.colnames <- TRUE\r
-  }\r
-\r
-  if (colnames.format == "multiple"){\r
-    if (is.null(sanitize.colnames.function)) {\r
-      colHead <- names(x[[1]])\r
-    } else {\r
-      colHead <- sanitize.colnames.function(names(x[[1]]))\r
-    }\r
-    if (rotate.colnames) {\r
-      colHead <- paste("\\begin{sideways}", colHead, "\\end{sideways}")\r
-    }\r
-    colHead <- paste0(colHead, collapse = " & ")\r
-    colHead <- paste0(tRule, "\n", colHead, " \\\\", mRule, "\n")\r
-    add.to.row <- list(pos = NULL, command = NULL)\r
-    add.to.row$pos <- as.list(c(0, c(combinedRowNums[1:length(x)])))\r
-    command <- sapply(x, attr, "subheading")\r
-    add.to.row$command[1] <-\r
-      paste0("\n\\multicolumn{", nCols, "}{l}{", command[1], "}", " \\\\ \n",\r
-             colHead)\r
-    add.to.row$command[2:length(x)] <-\r
-      paste0(bRule,\r
-             "\\\\ \n\\multicolumn{", nCols, "}{l}{",\r
-             command[2:length(x)], "}",\r
-             "\\\\ \n",\r
-             colHead)\r
-    if ( (booktabs) & length(attr(x, "message") > 0) ){\r
-      attr(x, "message")[1] <-\r
-        paste0("\\rule{0em}{2.5ex}", attr(x, "message")[1])\r
-    }\r
-    add.to.row$command[length(x) + 1] <-\r
-      paste0("\n\\multicolumn{", nCols, "}{l}{", attr(x, "message"), "}\\\\\n",\r
-             collapse = "")\r
-    add.to.row$command[length(x) + 1] <-\r
-      paste0(bRule, add.to.row$command[length(x) + 1])\r
-\r
-    class(combined) <- c("xtableList", "data.frame")\r
-    hline.after <- NULL\r
-\r
-    include.colnames <- FALSE\r
-  }\r
-\r
-  print.xtable(combined,\r
-               type = type,\r
-               floating = floating,\r
-               floating.environment = floating.environment,\r
-               table.placement = table.placement,\r
-               caption.placement = caption.placement,\r
-               caption.width = caption.width,\r
-               latex.environments = latex.environments,\r
-               tabular.environment = tabular.environment,\r
-               size = size,\r
-               hline.after = hline.after,\r
-               NA.string = NA.string,\r
-               include.rownames = include.rownames,\r
-               include.colnames = include.colnames,\r
-               only.contents = only.contents,\r
-               add.to.row = add.to.row,\r
-               sanitize.text.function = sanitize.text.function,\r
-               sanitize.rownames.function = sanitize.rownames.function,\r
-               sanitize.colnames.function = sanitize.colnames.function,\r
-               math.style.negative = math.style.negative,\r
-               html.table.attributes = html.table.attributes,\r
-               print.results = print.results,\r
-               format.args = format.args,\r
-               rotate.rownames = rotate.rownames,\r
-               rotate.colnames = rotate.colnames,\r
-               booktabs = booktabs,\r
-               scalebox = scalebox,\r
-               width = width,\r
-               comment = comment,\r
-               timestamp = timestamp,\r
-               ...)\r
-\r
-}\r
diff --git a/pkg/R/print.xtableMatharray.R b/pkg/R/print.xtableMatharray.R
deleted file mode 100644 (file)
index 5c83175..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-print.xtableMatharray <- function(x,
-           print.results = TRUE,
-           format.args = getOption("xtable.format.args", NULL),
-           scalebox = getOption("xtable.scalebox", NULL),
-           comment = FALSE,
-           timestamp = NULL,
-           ...)
-{
-  class(x) <- c("xtableMatharray","data.frame")
-  print.xtable(x, floating = FALSE,
-               tabular.environment = 'array',
-               include.rownames = FALSE, include.colnames = FALSE,
-               hline.after = NULL,
-               print.results = print.results,
-               format.args = format.args,
-               scalebox = scalebox,
-               comment = comment,
-               timestamp = timestamp,
-               ...)
-}
index 396f6fe4ef4d3206a3b929ca2a55b15872078e68..f46da90117807fc93f60edfe7908d66edb8b3d18 100644 (file)
@@ -67,21 +67,7 @@ xtable.matrix <- function(x, caption = NULL, label = NULL, align = NULL,
                            ...))
 }
 
-### xtableMatharray object
-### To deal with numeric arrays such as a variance-covariance matrix
-### From a request by James Curran, 16 October 2015
-xtable.xtableMatharray <- function(x, caption = NULL, label = NULL,
-                                   align = NULL, digits = NULL,
-                                   display = NULL, auto = FALSE,
-                                   ...) {
-  class(x) <- c("xtableMatharray","matrix")
-  xtbl <- xtable.matrix(x,
-                        caption = caption, label = label, align = align,
-                        digits = digits, display = display, auto = auto,
-                        ...)
-  class(xtbl) <- c("xtableMatharray","xtable","data.frame")
-  return(xtbl)
-}
+
 
 ### table objects (of 1 or 2 dimensions) by Guido Gay, 9 Feb 2007
 ### Fixed to pass R checks by DBD, 9 May 2007
@@ -319,59 +305,4 @@ xtable.zoo <- function(x, ...) {
   return(xtable(as.ts(x), ...))
 }
 
-### Function to create lists of tables
-xtable.xtableList <- function(x, caption = NULL, label = NULL, align = NULL,
-                              digits = NULL, display = NULL, ...) {
-  if (is.null(digits)){
-    digitsList <- vector("list", length(x))
-  } else {
-    if (!is.list(digits)){
-      digitsList <- vector("list", length(x))
-      for (i in 1:length(x)) digitsList[[i]] <- digits
-    }
-  }
-  if (is.null(display)){
-    displayList <- vector("list", length(x))
-  } else {
-    if (!is.list(display)){
-      displayList <- vector("list", length(x))
-      for (i in 1:length(x)) displayList[[i]] <- display
-    }
-  }
-  xList <- vector("list", length(x))
-  for (i in 1:length(x)){
-    xList[[i]] <- xtable(x[[i]], caption = caption, label = label,
-                         align = align, digits = digitsList[[i]],
-                         display = displayList[[i]], ...)
-    attr(xList[[i]], 'subheading') <- attr(x, 'subheadings')[[i]]
-  }
-  attr(xList, "message") <- attr(x, "message")
-  attr(xList, "caption") <- caption
-  attr(xList, "label") <- label
-  return(xList)
-}
 
-### Uses xtable.xtableList
-xtable.lsmeans <- function(x, caption = NULL, label = NULL,
-                           align = NULL, digits = NULL,
-                           display = NULL, auto = FALSE,
-                           ...){
-  if (attr(x, "estName") == "lsmean"){
-    xList <- split(x, f = x[, 2])
-    for (i in 1:length(xList)){
-      xList[[i]] <- as.data.frame(xList[[i]][, -2])
-    }
-    attr(xList, "subheadings") <-
-      paste0(dimnames(x)[[2]][2], " = ", levels(x[[2]]))
-    attr(xList, "message") <- c("", attr(x, "mesg"))
-    xList <- xtable.xtableList(xList, caption =caption, label = label,
-                           align = align, digits = digits,
-                           display = display, auto = auto, ...)
-  } else {
-    xList <- x
-    xList <- xtable.data.frame(xList, caption =caption, label = label,
-                           align = align, digits = digits,
-                           display = display, auto = auto, ...)
-  }
-  return(xList)
-}
diff --git a/pkg/R/xtableList.R b/pkg/R/xtableList.R
new file mode 100644 (file)
index 0000000..4ed695c
--- /dev/null
@@ -0,0 +1,205 @@
+### Function to create lists of tables\r
+xtableList <- function(x, caption = NULL, label = NULL, align = NULL,\r
+                              digits = NULL, display = NULL, ...) {\r
+  if (is.null(digits)){\r
+    digitsList <- vector("list", length(x))\r
+  } else {\r
+    if (!is.list(digits)){\r
+      digitsList <- vector("list", length(x))\r
+      for (i in 1:length(x)) digitsList[[i]] <- digits\r
+    }\r
+  }\r
+  if (is.null(display)){\r
+    displayList <- vector("list", length(x))\r
+  } else {\r
+    if (!is.list(display)){\r
+      displayList <- vector("list", length(x))\r
+      for (i in 1:length(x)) displayList[[i]] <- display\r
+    }\r
+  }\r
+  xList <- vector("list", length(x))\r
+  for (i in 1:length(x)){\r
+    xList[[i]] <- xtable(x[[i]], caption = caption, label = label,\r
+                         align = align, digits = digitsList[[i]],\r
+                         display = displayList[[i]], ...)\r
+    attr(xList[[i]], 'subheading') <- attr(x, 'subheadings')[[i]]\r
+  }\r
+  attr(xList, "message") <- attr(x, "message")\r
+  attr(xList, "caption") <- caption\r
+  attr(xList, "label") <- label\r
+  class(xList) <- c("xtableList", "data.frame")\r
+  return(xList)\r
+}\r
+\r
+print.xtableList <- function(x,\r
+  type = getOption("xtable.type", "latex"),\r
+  file = getOption("xtable.file", ""),\r
+  append = getOption("xtable.append", FALSE),\r
+  floating = getOption("xtable.floating", TRUE),\r
+  floating.environment = getOption("xtable.floating.environment", "table"),\r
+  table.placement = getOption("xtable.table.placement", "ht"),\r
+  caption.placement = getOption("xtable.caption.placement", "bottom"),\r
+  caption.width = getOption("xtable.caption.width", NULL),\r
+  latex.environments = getOption("xtable.latex.environments", c("center")),\r
+  tabular.environment = getOption("xtable.tabular.environment", "tabular"),\r
+  size = getOption("xtable.size", NULL),\r
+  hline.after = NULL,\r
+  NA.string = getOption("xtable.NA.string", ""),\r
+  include.rownames = getOption("xtable.include.rownames", TRUE),\r
+  include.colnames = getOption("xtable.include.colnames", TRUE),\r
+  only.contents = getOption("xtable.only.contents", FALSE),\r
+  add.to.row = NULL,\r
+  sanitize.text.function = getOption("xtable.sanitize.text.function", NULL),\r
+  sanitize.rownames.function = getOption("xtable.sanitize.rownames.function",\r
+                                         sanitize.text.function),\r
+  sanitize.colnames.function = getOption("xtable.sanitize.colnames.function",\r
+                                         sanitize.text.function),\r
+  math.style.negative = getOption("xtable.math.style.negative", FALSE),\r
+  html.table.attributes = getOption("xtable.html.table.attributes", "border=1"),\r
+  print.results = getOption("xtable.print.results", TRUE),\r
+  format.args = getOption("xtable.format.args", NULL),\r
+  rotate.rownames = getOption("xtable.rotate.rownames", FALSE),\r
+  rotate.colnames = getOption("xtable.rotate.colnames", FALSE),\r
+  booktabs = getOption("xtable.booktabs", FALSE),\r
+  scalebox = getOption("xtable.scalebox", NULL),\r
+  width = getOption("xtable.width", NULL),\r
+  comment = getOption("xtable.comment", TRUE),\r
+  timestamp = getOption("xtable.timestamp", date()),\r
+  colnames.format = "single",\r
+  ...)\r
+{\r
+  ## Get number of rows for each table in list of tables\r
+  if (booktabs){\r
+    tRule <- "\\toprule"\r
+    mRule <- "\\midrule"\r
+    bRule <- "\\bottomrule"\r
+  } else {\r
+    tRule <- "\\hline"\r
+    mRule <- "\\hline"\r
+    bRule <- "\\hline"\r
+  }\r
+  nCols <- dim(x[[1]])[2]\r
+  rowNums <- sapply(x, dim)[1,]\r
+  combinedRowNums <- cumsum(rowNums)\r
+  combined <- do.call(rbind, x)\r
+  if (colnames.format == "single"){\r
+    add.to.row <- list(pos = NULL, command = NULL)\r
+    add.to.row$pos <- as.list(c(0, combinedRowNums[-length(x)],\r
+                                dim(combined)[1]))\r
+    command <- sapply(x, attr, "subheading")\r
+\r
+    add.to.row$command[1:length(x)] <-\r
+      paste0(mRule,"\n\\multicolumn{", nCols, "}{l}{", command, "}\\\\\n")\r
+    if ( (booktabs) & length(attr(x, "message") > 0) ){\r
+      attr(x, "message")[1] <-\r
+        paste0("\\rule{0em}{2.5ex}", attr(x, "message")[1])\r
+    }\r
+    add.to.row$command[length(x) + 1] <-\r
+      paste0("\n\\multicolumn{", nCols, "}{l}{", attr(x, "message"), "}\\\\\n",\r
+             collapse = "")\r
+    add.to.row$command[length(x) + 1] <-\r
+      paste0(bRule, add.to.row$command[length(x) + 1])\r
+\r
+    class(combined) <- c("xtableList", "data.frame")\r
+    hline.after <- c(-1)\r
+    include.colnames <- TRUE\r
+  }\r
+\r
+  if (colnames.format == "multiple"){\r
+    if (is.null(sanitize.colnames.function)) {\r
+      colHead <- names(x[[1]])\r
+    } else {\r
+      colHead <- sanitize.colnames.function(names(x[[1]]))\r
+    }\r
+    if (rotate.colnames) {\r
+      colHead <- paste("\\begin{sideways}", colHead, "\\end{sideways}")\r
+    }\r
+    colHead <- paste0(colHead, collapse = " & ")\r
+    colHead <- paste0(tRule, "\n", colHead, " \\\\", mRule, "\n")\r
+    add.to.row <- list(pos = NULL, command = NULL)\r
+    add.to.row$pos <- as.list(c(0, c(combinedRowNums[1:length(x)])))\r
+    command <- sapply(x, attr, "subheading")\r
+    add.to.row$command[1] <-\r
+      paste0("\n\\multicolumn{", nCols, "}{l}{", command[1], "}", " \\\\ \n",\r
+             colHead)\r
+    add.to.row$command[2:length(x)] <-\r
+      paste0(bRule,\r
+             "\\\\ \n\\multicolumn{", nCols, "}{l}{",\r
+             command[2:length(x)], "}",\r
+             "\\\\ \n",\r
+             colHead)\r
+    if ( (booktabs) & length(attr(x, "message") > 0) ){\r
+      attr(x, "message")[1] <-\r
+        paste0("\\rule{0em}{2.5ex}", attr(x, "message")[1])\r
+    }\r
+    add.to.row$command[length(x) + 1] <-\r
+      paste0("\n\\multicolumn{", nCols, "}{l}{", attr(x, "message"), "}\\\\\n",\r
+             collapse = "")\r
+    add.to.row$command[length(x) + 1] <-\r
+      paste0(bRule, add.to.row$command[length(x) + 1])\r
+\r
+    class(combined) <- c("xtableList", "data.frame")\r
+    hline.after <- NULL\r
+\r
+    include.colnames <- FALSE\r
+  }\r
+\r
+  print.xtable(combined,\r
+               type = type,\r
+               floating = floating,\r
+               floating.environment = floating.environment,\r
+               table.placement = table.placement,\r
+               caption.placement = caption.placement,\r
+               caption.width = caption.width,\r
+               latex.environments = latex.environments,\r
+               tabular.environment = tabular.environment,\r
+               size = size,\r
+               hline.after = hline.after,\r
+               NA.string = NA.string,\r
+               include.rownames = include.rownames,\r
+               include.colnames = include.colnames,\r
+               only.contents = only.contents,\r
+               add.to.row = add.to.row,\r
+               sanitize.text.function = sanitize.text.function,\r
+               sanitize.rownames.function = sanitize.rownames.function,\r
+               sanitize.colnames.function = sanitize.colnames.function,\r
+               math.style.negative = math.style.negative,\r
+               html.table.attributes = html.table.attributes,\r
+               print.results = print.results,\r
+               format.args = format.args,\r
+               rotate.rownames = rotate.rownames,\r
+               rotate.colnames = rotate.colnames,\r
+               booktabs = booktabs,\r
+               scalebox = scalebox,\r
+               width = width,\r
+               comment = comment,\r
+               timestamp = timestamp,\r
+               ...)\r
+\r
+}\r
+\r
+\r
+### Uses xtableList\r
+xtablelsmeans <- function(x, caption = NULL, label = NULL,\r
+                           align = NULL, digits = NULL,\r
+                           display = NULL, auto = FALSE,\r
+                           ...){\r
+  if (attr(x, "estName") == "lsmean"){\r
+    xList <- split(x, f = x[, 2])\r
+    for (i in 1:length(xList)){\r
+      xList[[i]] <- as.data.frame(xList[[i]][, -2])\r
+    }\r
+    attr(xList, "subheadings") <-\r
+      paste0(dimnames(x)[[2]][2], " = ", levels(x[[2]]))\r
+    attr(xList, "message") <- c("", attr(x, "mesg"))\r
+    xList <- xtableList(xList, caption = caption, label = label,\r
+                        align = align, digits = digits,\r
+                        display = display, auto = auto, ...)\r
+  } else {\r
+    xList <- x\r
+    xList <- xtable.data.frame(xList, caption = caption, label = label,\r
+                           align = align, digits = digits,\r
+                           display = display, auto = auto, ...)\r
+  }\r
+  return(xList)\r
+}\r
diff --git a/pkg/R/xtableMatharray.R b/pkg/R/xtableMatharray.R
new file mode 100644 (file)
index 0000000..c782f59
--- /dev/null
@@ -0,0 +1,36 @@
+### xtableMatharray object\r
+### To deal with numeric arrays such as a variance-covariance matrix\r
+### From a request by James Curran, 16 October 2015\r
+xtableMatharray <- function(x, caption = NULL, label = NULL,\r
+                            align = NULL, digits = NULL,\r
+                            display = NULL, auto = FALSE,\r
+                            ...) {\r
+  class(x) <- c("xtableMatharray","matrix")\r
+  xtbl <- xtable.matrix(x,\r
+                        caption = caption, label = label, align = align,\r
+                        digits = digits, display = display, auto = auto,\r
+                        ...)\r
+  class(xtbl) <- c("xtableMatharray","xtable","data.frame")\r
+  return(xtbl)\r
+}\r
+\r
+print.xtableMatharray <- function(x,\r
+           print.results = TRUE,\r
+           format.args = getOption("xtable.format.args", NULL),\r
+           scalebox = getOption("xtable.scalebox", NULL),\r
+           comment = FALSE,\r
+           timestamp = NULL,\r
+           ...)\r
+{\r
+  class(x) <- c("xtableMatharray","data.frame")\r
+  print.xtable(x, floating = FALSE,\r
+               tabular.environment = 'array',\r
+               include.rownames = FALSE, include.colnames = FALSE,\r
+               hline.after = NULL,\r
+               print.results = print.results,\r
+               format.args = format.args,\r
+               scalebox = scalebox,\r
+               comment = comment,\r
+               timestamp = timestamp,\r
+               ...)\r
+}\r
index e725f938235aaa4fb0105cdf45a7a315b1408e3a..b521e268756b0f4f102f4f49ce577c59aeee9a95 100644 (file)
@@ -70,21 +70,21 @@ class(V) <- c("xtableMatharray")
 class(V)\r
 \r
 ### Test without any additional arguments\r
-mth <- xtable(V)\r
+mth <- xtableMatharray(V)\r
 str(mth)\r
 print(mth)\r
 \r
 ### Test with arguments to xtable\r
-mth <- xtable(V, display = rep("E", 4))\r
+mth <- xtableMatharray(V, display = rep("E", 4))\r
 str(mth)\r
 print(mth)\r
 \r
-mth <- xtable(V, digits = 6)\r
+mth <- xtableMatharray(V, digits = 6)\r
 str(mth)\r
 print(mth)\r
 \r
 ### Test with additional print.xtableMatharray arguments\r
-mth <- xtable(V, digits = 6)\r
+mth <- xtableMatharray(V, digits = 6)\r
 str(mth)\r
 print(mth, format.args = list(decimal.mark = ","))\r
 print(mth, scalebox = 0.5)\r
index 3d5198b32834689f2b3ef37e7d445cad53f33552..67f479f5b30f75c70d74f81b77b4fb7ea0b6c06e 100644 (file)
@@ -1,7 +1,8 @@
 \name{xtable-internal}\r
-\alias{xtable.xtableList}\r
+\alias{xtableMatharray}\r
+\alias{xtableList}\r
 \alias{print.xtableList}\r
-\alias{xtable.lsmeans}\r
+\alias{xtablelsmeans}\r
 \r
 \title{Internal xtable Functions}\r
 \description{\r
index 33bb8cd9a28173b03629cc558b252edcc291cd47..f6a5af5b0b916bee1079820bb1e49a6ebc51340c 100644 (file)
@@ -18,6 +18,7 @@
 \alias{xtable.ts}
 \alias{xtable.table}
 \alias{xtable.zoo}
+\alias{xtable.xtableList}
 \title{Create Export Tables}
 \description{
   Convert an R object to an \code{xtable} object, which can
@@ -111,9 +112,16 @@ xtable(x, caption = NULL, label = NULL, align = NULL, digits = NULL,
   have attributes \code{caption} and \code{label}, but must have
   attributes \code{align}, \code{digits}, and \code{display}.
 }
-\value{An object of class \code{"xtable"} which inherits the
-  \code{data.frame} class and contains several additional attributes
-  specifying the table formatting options.
+\value{
+  For most \code{xtable} methods, an object of class \code{"xtable"}
+  which inherits the \code{data.frame} class and contains several
+  additional attributes specifying the table formatting options.
+
+  In the case of the \code{xtableMatharray} method, an object of class
+  \code{xtableMatharray}, which the \code{xtable} and \code{data.frame}
+  classes and contains several additional attributes specifying the
+  table formatting options.
+
 }
 \author{David Dahl \email{dahl@stat.byu.edu} with contributions and
   suggestions from many others (see source code).
index 3f51aa288281aa6c565ee5d027b2a8930f08f955..172ff92c4c8df5d00f0f403bc07988165ed8c98b 100644 (file)
@@ -9,21 +9,21 @@ class(V) <- c("xtableMatharray")
 class(V)
 
 ### Test without any additional arguments
-mth <- xtable(V)
+mth <- xtableMatharray(V)
 str(mth)
 print(mth)
 
 ### Test with arguments to xtable
-mth <- xtable(V, display = rep("E", 4))
+mth <- xtableMatharray(V, display = rep("E", 4))
 str(mth)
 print(mth)
 
-mth <- xtable(V, digits = 6)
+mth <- xtableMatharray(V, digits = 6)
 str(mth)
 print(mth)
 
 ### Test with additional print.xtableMatharray arguments
-mth <- xtable(V, digits = 6)
+mth <- xtableMatharray(V, digits = 6)
 str(mth)
 print(mth, format.args = list(decimal.mark = ","))
 print(mth, scalebox = 0.5)
index 34fbd38a591daeac9f522668ddebac5deb8483c0..be627e6861b78ce0918894e03b793e0206d6ecf2 100644 (file)
@@ -72,7 +72,7 @@ Now create a list of \code{xtable} objects.
 \r
 \r
 <<xtablelist>>=\r
-xList <- xtable.xtableList(mtcarsList)\r
+xList <- xtableList(mtcarsList)\r
 str(xList)\r
 @ %def\r
 \r
@@ -81,12 +81,12 @@ for \code{digits}.
 \r
 \r
 <<xtablelist1>>=\r
-xList1 <- xtable.xtableList(mtcarsList, digits = c(0,2,0,0,0,1,2))\r
+xList1 <- xtableList(mtcarsList, digits = c(0,2,0,0,0,1,2))\r
 str(xList1)\r
 @ %def\r
 \r
 <<xtablelist2>>=\r
-xList2 <- xtable.xtableList(mtcarsList, digits = c(0,2,0,0,0,1,2),\r
+xList2 <- xtableList(mtcarsList, digits = c(0,2,0,0,0,1,2),\r
                             caption = "Caption to List",\r
                             label = "tbl:xtableList")\r
 str(xList2)\r
@@ -197,7 +197,7 @@ library(lsmeans)
 warp.lm <- lm(breaks ~ wool*tension, data = warpbreaks)\r
 warp.lsm <- lsmeans(warp.lm, ~ tension | wool)\r
 warp.sum <- summary(warp.lsm, adjust = "mvt")\r
-warp.xtblList <- xtable.lsmeans(warp.sum, digits = c(0,0,2,2,0,2,2))\r
+warp.xtblList <- xtablelsmeans(warp.sum, digits = c(0,0,2,2,0,2,2))\r
 str(warp.xtblList)\r
 @ %def\r
 \r