]> git.donarmstrong.com Git - xtable.git/commitdiff
Removed format.ftable.R and format.ftable.Rd
authordscott <dscott@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Fri, 29 Jan 2016 02:03:05 +0000 (02:03 +0000)
committerdscott <dscott@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Fri, 29 Jan 2016 02:03:05 +0000 (02:03 +0000)
git-svn-id: svn://scm.r-forge.r-project.org/svnroot/xtable@106 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

pkg/R/format.ftable.R [deleted file]
pkg/man/format.ftable.Rd [deleted file]

diff --git a/pkg/R/format.ftable.R b/pkg/R/format.ftable.R
deleted file mode 100644 (file)
index 065cd3a..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-### copy of function stats:::format.ftable because unexported from stats\r
-format.ftable <- function (x, quote = TRUE, digits = getOption("digits"),\r
-                           method = c("non.compact", "row.compact",\r
-                               "col.compact", "compact"),\r
-                           lsep = " | ", ...)\r
-{\r
-  if (!inherits(x, "ftable"))\r
-    stop("'x' must be an \"ftable\" object")\r
-  charQuote <- function(s) {\r
-    if (quote && length(s)){\r
-      paste0("\"", s, "\"")\r
-    } else {\r
-      s\r
-    }\r
-  }\r
-  makeLabels <- function(lst) {\r
-    lens <- lengths(lst)\r
-    cplensU <- c(1, cumprod(lens))\r
-    cplensD <- rev(c(1, cumprod(rev(lens))))\r
-    y <- NULL\r
-    for (i in rev(seq_along(lst))) {\r
-      ind <- 1 + seq.int(from = 0, to = lens[i] - 1) *\r
-          cplensD[i + 1L]\r
-      tmp <- character(length = cplensD[i])\r
-      tmp[ind] <- charQuote(lst[[i]])\r
-      y <- cbind(rep(tmp, times = cplensU[i]), y)\r
-    }\r
-    y\r
-  }\r
-  makeNames <- function(x) {\r
-    nmx <- names(x)\r
-    if (is.null(nmx)) {\r
-      rep_len("", length(x))\r
-    } else {\r
-      nmx\r
-    }\r
-  }\r
-  l.xrv <- length(xrv <- attr(x, "row.vars"))\r
-  l.xcv <- length(xcv <- attr(x, "col.vars"))\r
-  method <- match.arg(method)\r
-  if (l.xrv == 0) {\r
-    if (method == "col.compact"){\r
-      method <- "non.compact"\r
-    } else if (method == "compact") {\r
-      method <- "row.compact"\r
-    }\r
-  }\r
-  if (l.xcv == 0) {\r
-    if (method == "row.compact") {\r
-      method <- "non.compact"\r
-    } else if (method == "compact") {\r
-      method <- "col.compact"\r
-    }\r
-  }\r
-  LABS <- switch(method,\r
-                 non.compact =\r
-                     {cbind(rbind(matrix("",\r
-                                         nrow = length(xcv),\r
-                                         ncol = length(xrv)),\r
-                                  charQuote(makeNames(xrv)),\r
-                                  makeLabels(xrv)),\r
-                            c(charQuote(makeNames(xcv)),\r
-                              rep("", times = nrow(x) + 1)))},\r
-                 row.compact =\r
-                     {cbind(rbind(matrix("",\r
-                                         nrow = length(xcv) - 1,\r
-                                         ncol = length(xrv)),\r
-                                  charQuote(makeNames(xrv)),\r
-                                  makeLabels(xrv)),\r
-                            c(charQuote(makeNames(xcv)),\r
-                              rep("", times = nrow(x))))},\r
-                 col.compact =\r
-                     {cbind(rbind(cbind(matrix("",\r
-                                               nrow = length(xcv),\r
-                                               ncol = length(xrv) - 1),\r
-                                        charQuote(makeNames(xcv))),\r
-                                  charQuote(makeNames(xrv)),\r
-                                  makeLabels(xrv)))},\r
-                 compact =\r
-                     {xrv.nms <- makeNames(xrv)\r
-                      xcv.nms <- makeNames(xcv)\r
-                      mat <-\r
-                        cbind(rbind(cbind(matrix("",\r
-                                                 nrow = l.xcv - 1,\r
-                                                 ncol = l.xrv - 1),\r
-                                          charQuote(makeNames(xcv[-l.xcv]))),\r
-                                    charQuote(xrv.nms), makeLabels(xrv)))\r
-                      mat[l.xcv, l.xrv] <- paste(tail(xrv.nms, 1),\r
-                                                 tail(xcv.nms, 1),\r
-                                                 sep = lsep)\r
-                      mat},\r
-                 stop("wrong method"))\r
-  DATA <- rbind(if (length(xcv)) t(makeLabels(xcv)),\r
-                if (method %in% c("non.compact", "col.compact"))\r
-                  { rep("", times = ncol(x)) },\r
-                format(unclass(x), digits = digits,  ...) )\r
-  cbind(apply(LABS, 2L, format, justify = "left"),\r
-        apply(DATA, 2L, format, justify = "right"))\r
-}\r
diff --git a/pkg/man/format.ftable.Rd b/pkg/man/format.ftable.Rd
deleted file mode 100644 (file)
index 962af8c..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-%% File src/library/stats/man/read.ftable.Rd\r
-%% Part of the R package, https://www.R-project.org\r
-%% Copyright 1995-2014 R Core Team\r
-%% Copyright 2002-2013 The R Foundation\r
-%% Distributed under GPL 2 or later\r
-\r
-%% Copied to document copy of unexported function format.ftable\r
-\r
-\name{format.ftable}\r
-\title{Format Flat Contingency Tables}\r
-\alias{format.ftable}\r
-\description{\r
-  Format \sQuote{flat} contingency tables.\r
-}\r
-\usage{\r
-\method{format}{ftable}(x, quote = TRUE, digits = getOption("digits"),\r
-                        method = c("non.compact", "row.compact",\r
-                                  "col.compact", "compact"),\r
-                        lsep = " | ", \dots)\r
-}\r
-\arguments{\r
-  \item{x}{an object of class \code{"ftable"}.}\r
-  \item{quote}{a character string giving the set of quoting characters\r
-    for \code{read.ftable}; to disable quoting altogether, use\r
-    \code{quote=""}.  For \code{write.table}, a logical indicating\r
-    whether strings in the data will be surrounded by double quotes.}\r
-  \item{digits}{an integer giving the number of significant digits to\r
-    use for (the cell entries of) \code{x}.}\r
-  \item{method}{string specifying how the \code{"ftable"} object is formatted\r
-    (and printed if used as in \code{write.ftable()} or the \code{print}\r
-    method).  Can be abbreviated.  Available methods are (see the examples):\r
-    \describe{\r
-      \item{"non.compact"}{the default representation of an\r
-        \code{"ftable"} object.}\r
-      \item{"row.compact"}{a row-compact version without empty cells\r
-        below the column labels.}\r
-      \item{"col.compact"}{a column-compact version without empty cells\r
-        to the right of the row labels.}\r
-      \item{"compact"}{a row- and column-compact version.  This may imply\r
-        a row and a column label sharing the same cell.  They are then\r
-        separated by the string \code{lsep}.}\r
-    }\r
-  }\r
-  \item{lsep}{only for \code{method = "compact"}, the separation string\r
-    for row and column labels.}\r
-  \item{\dots}{further arguments such as \code{method}, passed to\r
-    \code{format()}.}\r
-}\r
-\details{\r
-  This format method is a copy of \code{format.ftable} from\r
-  \pkg{stats}, and this man page is derived from the page\r
-  \code{\link[stats]{read.ftable}}.\r
-}\r
-\seealso{\r
-  \code{\link[stats]{ftable}} and\r
-  \code{\link[stats]{read.ftable}} for more information on flat\r
-  contingency tables.\r
-}\r
-\examples{\r
-ft22 <- ftable(Titanic, row.vars = 2:1, col.vars = 4:3)\r
-write.ftable(ft22, quote = FALSE)\r
-write.ftable(ft22, quote = FALSE, method="row.compact")\r
-write.ftable(ft22, quote = FALSE, method="col.compact")\r
-write.ftable(ft22, quote = FALSE, method="compact")\r
-}\r
-\keyword{category}\r