Learn R Programming

ff (version 4.5.0)

vw: Getting and setting virtual windows

Description

The virtual window vw function allows one to define a virtual window into an ff_vector or ff_array. The ff object will behave like a smaller array and it is mapped into the specified region of the complete array. This allows for example to execute recursive divide and conquer algorithms that work on parts of the full object, without the need to repeatedly create subfiles.

Usage

vw(x, ...)
vw(x, ...) <- value
# S3 method for ff
vw(x, ...)
# S3 method for default
vw(x, ...)
# S3 method for ff_vector
vw(x, ...) <- value
# S3 method for ff_array
vw(x, ...) <- value

Value

NULL or a vw specification, see details

Arguments

x

an ff_vector or ff_array

...

further arguments (not used)

value

a vector or matrix with an Offset, Window and Rest component, see details and examples

Author

Jens Oehlschlägel

Details

Each dimension of an ff array (or vector) is decomposed into three components, an invisible Offset, a visibe Window and an invisible Rest. For each dimension the sum of the vw components must match the dimension (or length). For an ff_vector, vw is simply a vector[1:3], for an array is is a matrix[1:3,seq_along(dim(x))]. vw is a virtual attribute.

See Also

length.ff, dim.ff, virtual

Examples

Run this code
  x <- ff(1:26, names=letters)
  y <- x
  vw(x) <- c(0, 13, 13)
  vw(y) <- c(13, 13, 0)
  x
  y
  x[1] <- -1
  y[1] <- -2
  vw(x) <- NULL
  x[]

  z <- ff(1:24, dim=c(4,6), dimnames=list(letters[1:4], LETTERS[1:6]))
  z
  vw(z) <- rbind(c(1,1), c(2,4), c(1,1))
  z

  rm(x,y,z); gc()

Run the code above in your browser using DataLab