SCM

SCM Repository

[matrix] Diff of /pkg/R/sparseMatrix.R
ViewVC logotype

Diff of /pkg/R/sparseMatrix.R

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

revision 1869, Tue Jun 5 15:03:49 2007 UTC revision 1870, Tue Jun 5 16:28:55 2007 UTC
# Line 224  Line 224 
224  ## - - -   prMatrix() from ./Auxiliaries.R  ## - - -   prMatrix() from ./Auxiliaries.R
225  prSpMatrix <- function(object, digits = getOption("digits"),  prSpMatrix <- function(object, digits = getOption("digits"),
226                         maxp = getOption("max.print"), zero.print = ".",                         maxp = getOption("max.print"), zero.print = ".",
227                         row.trailer = '',                         col.trailer = '', align = c("fancy", "right"))
                        align = c("fancy", "right"))  
228  ## FIXME: prTriang() in ./Auxiliaries.R  should also get  align = "fancy"  ## FIXME: prTriang() in ./Auxiliaries.R  should also get  align = "fancy"
229  {  {
230      cl <- getClassDef(class(object))      cl <- getClassDef(class(object))
# Line 249  Line 248 
248              dimnames(x) <- dimnames(m)              dimnames(x) <- dimnames(m)
249          }          }
250      }      }
251      x <- emptyColnames(x)      x <- emptyColnames(x, msg.if.not.empty = TRUE)
252      if(is.logical(zero.print))      if(is.logical(zero.print))
253          zero.print <- if(zero.print) "0" else " "          zero.print <- if(zero.print) "0" else " "
254      if(logi) {      if(logi) {
# Line 290  Line 289 
289          } else if (ne == 0)# all zeroes          } else if (ne == 0)# all zeroes
290              x[] <- zero.print              x[] <- zero.print
291      }      }
292      if(row.trailer != '')      if(col.trailer != '')
293          x <- cbind(x, row.trailer, deparse.level = 0)          x <- cbind(x, col.trailer, deparse.level = 0)
294      ## right = TRUE : cheap attempt to get better "." alignment      ## right = TRUE : cheap attempt to get better "." alignment
295      print(x, quote = FALSE, right = TRUE, max = maxp)      print(x, quote = FALSE, right = TRUE, max = maxp)
296      invisible(object)      invisible(object)
# Line 315  Line 314 
314    
315             suppCols <- (d[2] * 2 > useW)             suppCols <- (d[2] * 2 > useW)
316             nc <- if(suppCols) (useW - (1 + 6)) %/% 2 else d[2]             nc <- if(suppCols) (useW - (1 + 6)) %/% 2 else d[2]
317             ##                          sp+ row.trailer             ##                          sp+ col.trailer
318             row.trailer <- if(suppCols) "......" else ""             col.trailer <- if(suppCols) "......" else ""
319             nr <- maxp %/% nc             nr <- maxp %/% nc
320             suppRows <- (nr < nR)             suppRows <- (nr < nR)
321             if(suppRows) {             if(suppRows) {
# Line 324  Line 323 
323                     object <- object[ , 1:nc, drop = FALSE]                     object <- object[ , 1:nc, drop = FALSE]
324                 n2 <- ceiling(nr / 2)                 n2 <- ceiling(nr / 2)
325                 prSpMatrix(object[seq_len(min(nR, max(1, n2))), , drop=FALSE],                 prSpMatrix(object[seq_len(min(nR, max(1, n2))), , drop=FALSE],
326                            row.trailer = row.trailer)                            col.trailer = col.trailer)
327                 cat("\n ..............................",                 cat("\n ..............................",
328                     "\n ..........suppressing rows in show(); maybe adjust 'options(max.print= *)'",                     "\n ..........suppressing rows in show(); maybe adjust 'options(max.print= *)'",
329                     "\n ..............................\n\n", sep='')                     "\n ..............................\n\n", sep='')
330                 ## tail() automagically uses "[..,]" rownames:                 ## tail() automagically uses "[..,]" rownames:
331                 prSpMatrix(tail(object, max(1, nr-n2)),                 prSpMatrix(tail(object, max(1, nr-n2)),
332                            row.trailer = row.trailer)                            col.trailer = col.trailer)
333             }             }
334             else if(suppCols) {             else if(suppCols) {
335                 prSpMatrix(object[ , 1:nc , drop = FALSE],                 prSpMatrix(object[ , 1:nc , drop = FALSE],
336                            row.trailer = row.trailer)                            col.trailer = col.trailer)
337    
338                 cat("\n .....suppressing columns in show(); maybe adjust 'options(max.print= *)'",                 cat("\n .....suppressing columns in show(); maybe adjust 'options(max.print= *)'",
339                     "\n ..............................\n", sep='')                     "\n ..............................\n", sep='')

Legend:
Removed from v.1869  
changed lines
  Added in v.1870

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