The R Project SVN R-packages

Rev

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

Rev 4817 Rev 4871
Line 15... Line 15...
15
	  else stop("coercion to 'pMatrix' only works from integer numeric"))
15
	  else stop("coercion to 'pMatrix' only works from integer numeric"))
16
 
16
 
17
setAs("pMatrix", "matrix",
17
setAs("pMatrix", "matrix",
18
      function(from) {
18
      function(from) {
19
	  fp <- from@perm
19
	  fp <- from@perm
20
	  r <- diag(nrow = length(fp))[fp,]
20
	  r <- idiag(n = length(fp))[fp,]
21
	  if(.has.DN(from)) dimnames(r) <- from@Dimnames
21
	  if(.has.DN(from)) dimnames(r) <- from@Dimnames
22
	  r
22
	  r
23
      })
23
      })
24
 
24
 
25
## coerce to 0/1 sparse matrix, i.e. sparse pattern
25
## coerce to 0/1 sparse matrix, i.e. sparse pattern