Subscript-methods | R Documentation |

Methods for `"["`

, i.e., extraction or subsetting mostly of
matrices, in package Matrix.

There are more than these:

- x = "Matrix", i = "missing", j = "missing", drop= "ANY"
...

- x = "Matrix", i = "numeric", j = "missing", drop= "missing"
...

- x = "Matrix", i = "missing", j = "numeric", drop= "missing"
...

- x = "dsparseMatrix", i = "missing", j = "numeric", drop= "logical"
...

- x = "dsparseMatrix", i = "numeric", j = "missing", drop= "logical"
...

- x = "dsparseMatrix", i = "numeric", j = "numeric", drop= "logical"
...

`[<â€“methods`

for sub*assign*ment to `"Matrix"`

objects.
`Extract`

about the standard extraction.

```
str(m <- Matrix(round(rnorm(7*4),2), nrow = 7))
stopifnot(identical(m, m[]))
m[2, 3] # simple number
m[2, 3:4] # simple numeric of length 2
m[2, 3:4, drop=FALSE] # sub matrix of class 'dgeMatrix'
## rows or columns only:
m[1,] # first row, as simple numeric vector
m[,1:2] # sub matrix of first two columns
showMethods("[", inherited = FALSE)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.