vw.rdThe 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.
vw(x, ...)
vw(x, ...) <- value
# S3 method for class 'ff'
vw(x, ...)
# Default S3 method
vw(x, ...)
# S3 method for class 'ff_vector'
vw(x, ...) <- value
# S3 method for class 'ff_array'
vw(x, ...) <- valueEach 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.
NULL or a vw specification, see details
x <- ff(1:26, names=letters)
y <- x
vw(x) <- c(0, 13, 13)
vw(y) <- c(13, 13, 0)
x
#> ff (open) integer offset=0 length=13 totallength=26 (26)
#> a b c d e f g h i j k l m
#> 1 2 3 4 5 6 7 : 8 9 10 11 12 13
y
#> ff (open) integer offset=13 length=13 totallength=26 (26)
#> n o p q r s t u v w x y z
#> 14 15 16 17 18 19 20 : 21 22 23 24 25 26
x[1] <- -1
y[1] <- -2
vw(x) <- NULL
x[]
#> a b c d e f g h i j k l m n o p q r s t u v w x y z
#> -1 2 3 4 5 6 7 8 9 10 11 12 13 -2 15 16 17 18 19 20 21 22 23 24 25 26
z <- ff(1:24, dim=c(4,6), dimnames=list(letters[1:4], LETTERS[1:6]))
z
#> ff (open) integer length=24 (24) dim=c(4,6) dimorder=c(1,2)
#> A B C D E F
#> a 1 5 9 13 17 21
#> b 2 6 10 14 18 22
#> c 3 7 11 15 19 23
#> d 4 8 12 16 20 24
vw(z) <- rbind(c(1,1), c(2,4), c(1,1))
z
#> ff (open) integer length=8 (24) offset=c(1,1) dim=c(2,4) totaldim=c(4,6) dimorder=c(1,2)
#> B C D E
#> b 6 10 14 18
#> c 7 11 15 19
rm(x,y,z); gc()
#> used (Mb) gc trigger (Mb) max used (Mb)
#> Ncells 1182424 63.2 1994352 106.6 1994352 106.6
#> Vcells 2207151 16.9 8790397 67.1 8790397 67.1