06-Extract-Replace | R Documentation |
Extract or replace elements from an MPCR object using the '[', '[[', '[<-', and '[[<-' operators. When extracting values, they will be converted to double precision. However, if you update a single object, the double value will be cast down to match the precision. If the MPCR object is a matrix and you access it using the 'i' index, the operation is assumed to be performed in column-major order, or using 'i' and 'j' index.
## S4 method for signature 'Rcpp_MPCR'
x[i, j, drop = TRUE]
## S4 replacement method for signature 'Rcpp_MPCR'
x[i, j, ...] <- value
## S4 method for signature 'Rcpp_MPCR'
x[[i, drop = TRUE]]
## S4 replacement method for signature 'Rcpp_MPCR'
x[[i, ...]] <- value
x |
An MPCR object. |
i |
Row index or indices. |
j |
Column index or indices. |
... |
ignored. |
drop |
ignored. |
value |
A value to replace the selected elements with. |
library(MPCR)
x <-as.MPCR(1:50,precision="single")
ext <- x[5]
x[5] <- 0
x$ToMatrix(5,10)
x[2,5]
x[3,5] <- 100
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.