SCM

SCM Repository

[matrix] Diff of /pkg/man/sparseMatrix-class.Rd
ViewVC logotype

Diff of /pkg/man/sparseMatrix-class.Rd

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1902, Sat Jun 16 15:54:54 2007 UTC revision 1903, Sat Jun 16 18:31:51 2007 UTC
# Line 30  Line 30 
30  \alias{-,sparseMatrix,missing-method}  \alias{-,sparseMatrix,missing-method}
31  \alias{diag,sparseMatrix-method}  \alias{diag,sparseMatrix-method}
32  \alias{dim<-,sparseMatrix-method}  \alias{dim<-,sparseMatrix-method}
33    \alias{print,sparseMatrix-method}
34  \alias{show,sparseMatrix-method}  \alias{show,sparseMatrix-method}
35  \alias{summary,sparseMatrix-method}  \alias{summary,sparseMatrix-method}
36  %\alias{colMeans,..} etc are now in ./colSums.Rd  %\alias{colMeans,..} etc are now in ./colSums.Rd
# Line 61  Line 62 
62  }  }
63  \section{Methods}{  \section{Methods}{
64    \describe{    \describe{
65    %% FIXME: better description of print() / show(); notably explain the
66    %% print() arguments !
67      \item{show}{\code{(object = "sparseMatrix")}: The      \item{show}{\code{(object = "sparseMatrix")}: The
68        \code{\link{show}} method for sparse matrices prints        \code{\link{show}} method for sparse matrices prints
69        \emph{\dQuote{structural}} zeroes as \code{"."} using the        \emph{\dQuote{structural}} zeroes as \code{"."} using the
# Line 69  Line 72 
72    
73        Note that \code{\link{options}(max.print)} will influence how many        Note that \code{\link{options}(max.print)} will influence how many
74        entries of large matrices are printed at all.}        entries of large matrices are printed at all.}
75        \item{print}{\code{signature(x = "sparseMatrix")}, extra arguments
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
80          same as \code{show()} but can be called with extra optional arguments.}
81    
82      \item{summary}{\code{(object = "sparseMatrix")}: Returns      \item{summary}{\code{(object = "sparseMatrix")}: Returns
83        an object of S3 class \code{"sparseSummary"} which is basically a        an object of S3 class \code{"sparseSummary"} which is basically a
84        \code{\link{data.frame}} with columns \code{(i,j,x)} with the        \code{\link{data.frame}} with columns \code{(i,j,x)} with the
# Line 80  Line 90 
90        allows to \emph{reshape} a sparse matrix to a sparse matrix with        allows to \emph{reshape} a sparse matrix to a sparse matrix with
91        the same entries but different dimensions. \code{value} must be of        the same entries but different dimensions. \code{value} must be of
92        length two and fulfill \code{prod(value) == prod(dim(x))}.}        length two and fulfill \code{prod(value) == prod(dim(x))}.}
93      \item{coerce}{\code{signature(from "factor", to = "sparseMatrix")}:      \item{coerce}{\code{signature(from = "factor", to = "sparseMatrix")}:
94        Coercion of a factor to \code{"sparseMatrix"} produces the matrix        Coercion of a factor to \code{"sparseMatrix"} produces the matrix
95        of indicator \bf{rows} stored as an object of class        of indicator \bold{rows} stored as an object of class
96        \code{"dgCMatrix"}.  To obtain columns represent the interaction        \code{"dgCMatrix"}.  To obtain columns representing the interaction
97        of the factor and a numeric covariate, replace the \code{"x"} slot        of the factor and a numeric covariate, replace the \code{"x"} slot
98        of the result by the numeric covariate then take the transpose.}        of the result by the numeric covariate then take the transpose.}
99    }    }
# Line 103  Line 113 
113  showClass("sparseMatrix") ## and look at the help() of its subclasses  showClass("sparseMatrix") ## and look at the help() of its subclasses
114  M <- Matrix(0, 10000, 100)  M <- Matrix(0, 10000, 100)
115  M[1,1] <- M[2,3] <- 3.14  M[1,1] <- M[2,3] <- 3.14
116  M  M  ## show(.) method suppresses printing of the majority of rows
117  str(fact <- gl(5, 3, labels = LETTERS[1:5]))  
118  as(fact, "sparseMatrix")  # indicator rows  ## factor -> t( <sparse design matrix> ) :
119    (fact <- gl(5, 3, 30, labels = LETTERS[1:5]))
120    (Xt <- as(fact, "sparseMatrix"))  # indicator rows
121    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"  \dontshow{% show() was slow in 0.9975-8 because of slow adjust="fancy"
127  op <- options(max.print = 25000, width = 80)  op <- options(max.print = 25000, width = 80)
128  sink(print(tempfile()))  sink(print(tempfile()))

Legend:
Removed from v.1902  
changed lines
  Added in v.1903

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge