The R Project SVN R

Rev

Rev 62082 | Rev 68055 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 62082 Rev 62158
Line 19... Line 19...
19
             digits = getOption("digits"), \dots)
19
             digits = getOption("digits"), \dots)
20
 
20
 
21
\method{format}{ftable}(x, quote = TRUE, digits = getOption("digits"),
21
\method{format}{ftable}(x, quote = TRUE, digits = getOption("digits"),
22
                        method = c("non.compact", "row.compact",
22
                        method = c("non.compact", "row.compact",
23
                                  "col.compact", "compact"),
23
                                  "col.compact", "compact"),
24
                        lsep = " \\\\ ", \dots)
24
                        lsep = " | ", \dots)
25
\method{print}{ftable}(x, digits = getOption("digits"), \dots)
25
\method{print}{ftable}(x, digits = getOption("digits"), \dots)
26
}
26
}
27
\arguments{
27
\arguments{
28
  \item{file}{either a character string naming a file or a connection
28
  \item{file}{either a character string naming a file or a connection
29
    which the data are to be read from or written to.  \code{""}
29
    which the data are to be read from or written to.  \code{""}
Line 137... Line 137...
137
write.ftable(ft22, quote = FALSE)
137
write.ftable(ft22, quote = FALSE)
138
write.ftable(ft22, quote = FALSE, method="row.compact")
138
write.ftable(ft22, quote = FALSE, method="row.compact")
139
write.ftable(ft22, quote = FALSE, method="col.compact")
139
write.ftable(ft22, quote = FALSE, method="col.compact")
140
write.ftable(ft22, quote = FALSE, method="compact")
140
write.ftable(ft22, quote = FALSE, method="compact")
141
\dontshow{
141
\dontshow{
142
op <- options(warn = 2) # no warnings allowed
142
 op <- options(warn = 2) # no warnings allowed
143
stopifnot(dim(format(ft)) == 4:5,
143
 stopifnot(dim(format(ft)) == 4:5,
144
          dim(format(ftable(UCBAdmissions))) == c(6,9),
144
	   dim(format(ftable(UCBAdmissions))) == c(6,9))
145
          dim(format(ft22)) == c(11,7))
-
 
146
for(meth in c("non.compact", "row.compact", "col.compact", "compact")) {
145
 meths <- c("non.compact", "row.compact", "col.compact", "compact")
-
 
146
 dimform <- function(ft) sapply(meths, function(M) dim(format(ft, method=M)))
147
   cat("\nMethod ",meth,"\n-----------------\n")
147
 m.eq    <- function(M,m) all.equal(unname(M), m, tol=0)
148
   write.ftable(ft22, method=meth) # without warnings!
148
 ## All format(..) w/o warnings:
149
}
-
 
-
 
149
 stopifnot(m.eq(print(dimform(ft22)),
-
 
150
		rbind(11:10, rep(7:6, each=2))),
-
 
151
	   m.eq(print(dimform(ftable(Titanic, row.vars = integer()))),
-
 
152
		rbind(rep(6:5,2), 33)))
150
options(op)
153
 options(op)
151
}
154
}
152
}
155
}
153
\keyword{category}
156
\keyword{category}