Learn R Programming

gmp (version 0.5-4)

Extract: Extract or Replace Parts of an Object

Description

Operators acting on vectors, arrays and lists to extract or replace subsets.

Usage

## S3 method for class 'bigz':
c(..., recursive = FALSE)
## S3 method for class 'bigq':
c(..., recursive = FALSE)
## S3 method for class 'bigz':
rep(x,times, ...)
## S3 method for class 'bigq':
rep(x,times, ...)

Arguments

x
Robject of class "bigz" or "bigq", respectively.
...
further arguments, notably for c().
times
integer
recursive
unused here

Examples

Run this code
a <- as.bigz(123)
  ## indexing "outside" --> extends the vectors (filling with NA)
  a[2] <- a[1]
  a[4] <- -4

  ## create a vector of 3 a
  c(a,a,a)

  ## repeate a 5 times
  rep(a,5)

  ## with matrix
  m <- matrix.bigz(1:6,3)

  ## these do the same:
  m[1,]
  m[1]
  m[-c(2,3),]
  m[-c(2,3)]
  m[c(TRUE,FALSE,FALSE)]
stopifnot(identical(c(a,a), rep(a,2)),
            identical(rep(a,0), a[FALSE]), length(a[FALSE]) == 0,
            identical(m[1,], m[-(2:3),]),
            identical(m[1,], m[c(TRUE,FALSE,FALSE),])
  )
  ##_modification on matrix
  m[2,-1] <- 11

Run the code above in your browser using DataLab