SCM

SCM Repository

[matrix] Diff of /pkg/man/Subassign-methods.Rd
ViewVC logotype

Diff of /pkg/man/Subassign-methods.Rd

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

revision 1617, Fri Oct 6 15:42:12 2006 UTC revision 1618, Fri Oct 6 15:44:01 2006 UTC
# Line 16  Line 16 
16  \alias{[<-,denseMatrix,index,missing,numeric-method}  \alias{[<-,denseMatrix,index,missing,numeric-method}
17  \alias{[<-,denseMatrix,index,index,numeric-method}  \alias{[<-,denseMatrix,index,index,numeric-method}
18  \alias{[<-,denseMatrix,missing,index,numeric-method}  \alias{[<-,denseMatrix,missing,index,numeric-method}
19    % in ../R/diagMatrix.R
20    \alias{[<-,diagonalMatrix,ANY,ANY,ANY-method}
21  % -> ../R/Tsparse.R : replValue = { numeric, logical }  % -> ../R/Tsparse.R : replValue = { numeric, logical }
22  \alias{[<-,TsparseMatrix,index,index,replValue-method}  \alias{[<-,TsparseMatrix,index,index,replValue-method}
23  \alias{[<-,TsparseMatrix,index,missing,replValue-method}  \alias{[<-,TsparseMatrix,index,missing,replValue-method}
# Line 52  Line 54 
54    }    }
55  }  }
56  \seealso{  \seealso{
57      %% ./Xtrct-methods.Rd:
58    \code{\link{[-methods}} for subsetting \code{"Matrix"} objects; the    \code{\link{[-methods}} for subsetting \code{"Matrix"} objects; the
59    \code{\linkS4class{index}} class;    \code{\linkS4class{index}} class;
60    \code{\link{Extract}} about the standard subset assignment (and extraction).    \code{\link{Extract}} about the standard subset assignment (and extraction).
61  }  }
62  \examples{  \examples{
63  (m <- Matrix(round(rnorm(7*4),2), nrow = 7))  %% Note that ./Xtrct-methods.Rd has the indexing ones
64  stopifnot(identical(m, m[]))  set.seed(101)
65  m[2, 3]   # simple number  (a <- m <- Matrix(round(rnorm(7*4),2), nrow = 7))
66  m[2, 3:4] # simple numeric of length 2  % not yet available%% FIXME!
67    % a[] <- 2.2
68    m[2, 3]  <- 3.14 # simple number
69    m[3, 3:4]<- 3:4  # simple numeric of length 2
70    
71  m[2, 3:4, drop=FALSE] # sub matrix of class 'dgeMatrix'  ## sub matrix assignment:
72  m[-(4:7), 3:4]        # dito; the upper right corner of 'm'  m[-(4:7), 3:4] <- cbind(1,2:4) #-> upper right corner of 'm'
73    m[3:5, 2:3] <- 0
74    m[6:7, 1:2] <- Diagonal(2)
75    m
76    
77  ## rows or columns only:  ## rows or columns only:
78  m[1,]     # first row, as simple numeric vector  m[1,] <- 10
79  m[,2]     # 2nd column  m[,2] <- 1:7
80  m[,1:2]   # sub matrix of first two columns  m[-(1:6), ] <- 3:0 # not the first 6 rows, i.e. only the 7th
81  m[-(1:6),, drop=FALSE] # not the first 6 rows, i.e. only the 7th  as(m, "sparseMatrix")
82  }  }
83  \keyword{methods}  \keyword{methods}
84  \keyword{array}  \keyword{array}

Legend:
Removed from v.1617  
changed lines
  Added in v.1618

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