The R Project SVN R-packages

Rev

Rev 4529 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4529 Rev 4549
Line 60... Line 60...
60
\section{Extends}{
60
\section{Extends}{
61
  Class \code{"Matrix"}, directly.
61
  Class \code{"Matrix"}, directly.
62
}
62
}
63
\section{Methods}{
63
\section{Methods}{
64
  \describe{
64
  \describe{
65
%% FIXME: better description of print() / show(); notably explain the
-
 
66
%% print() arguments !
-
 
67
    \item{show}{\code{(object = "sparseMatrix")}: The
65
    \item{show}{\code{(object = "sparseMatrix")}: The
68
      \code{\link{show}} method for sparse matrices prints
66
      \code{\link{show}} method for sparse matrices prints
69
      \emph{\dQuote{structural}} zeroes as \code{"."} using the
67
      \emph{\dQuote{structural}} zeroes as \code{"."} using
70
      non-exported \code{prSpMatrix} function which allows further
68
      \code{\link{printSpMatrix}()} which allows further customization.}
71
      customization such as replacing \code{"."} by \code{" "} (blank).
-
 
72
 
-
 
73
      Note that \code{\link{options}(max.print)} will influence how many
-
 
74
      entries of large matrices are printed at all.}
-
 
75
    \item{print}{\code{signature(x = "sparseMatrix")}, extra arguments
69
    \item{print}{\code{signature(x = "sparseMatrix")}, ....\cr
76
      \code{digits = getOption("digits"), maxp = getOption("max.print"),
-
 
77
	zero.print = ".", col.names = FALSE, note.dropping.colnames = TRUE,
-
 
78
        col.trailer = '', align = c("fancy", "right")}: The
-
 
79
      \code{\link{print}} method for sparse matrices by default is the
70
      The \code{\link{print}} method for sparse matrices by default is the
80
      same as \code{show()} but can be called with extra optional arguments.}
71
      same as \code{show()} but can be called with extra optional
81
 
-
 
-
 
72
      arguments, see \code{\link{printSpMatrix}()}.}
82
    \item{summary}{\code{(object = "sparseMatrix")}: Returns
73
    \item{summary}{\code{(object = "sparseMatrix")}: Returns
83
      an object of S3 class \code{"sparseSummary"} which is basically a
74
      an object of S3 class \code{"sparseSummary"} which is basically a
84
      \code{\link{data.frame}} with columns \code{(i,j,x)} with the
75
      \code{\link{data.frame}} with columns \code{(i,j,x)} with the
85
      non-zero entries.   The \code{\link{print}} method resemble's
76
      non-zero entries.   The \code{\link{print}} method resemble's
86
      Matlab's way of printing sparse matrices.}
77
      Matlab's way of printing sparse matrices.}
Line 117... Line 108...
117
 
108
 
118
## factor -> t( <sparse design matrix> ) :
109
## factor -> t( <sparse design matrix> ) :
119
(fact <- gl(5, 3, 30, labels = LETTERS[1:5]))
110
(fact <- gl(5, 3, 30, labels = LETTERS[1:5]))
120
(Xt <- as(fact, "sparseMatrix"))  # indicator rows
111
(Xt <- as(fact, "sparseMatrix"))  # indicator rows
121
X <- t(Xt)
112
X <- t(Xt)
122
## printing :
-
 
123
X ## <==>  show(X)  <==>  print(X)
-
 
124
print(X, zero.print = "", col.names = TRUE)
-
 
125
 
-
 
126
\dontshow{% show() was slow in 0.9975-8 because of slow adjust="fancy"
-
 
127
op <- options(max.print = 25000, width = 80)
-
 
128
sink(print(tempfile()))
-
 
129
stopifnot((st <- system.time(show(M)))[1] < 1.0) # only 0.09 on cmath-3
-
 
130
sink()
-
 
131
st
-
 
132
options(op)
-
 
133
}
-
 
134
}
113
}
135
\keyword{classes}
114
\keyword{classes}