Get most conforming argument
ffconform.rdffconform returns position of 'most' conformable ff argument or zero if the arguments are not conforming
Details
A reference argument is defined to be the first argument with a dim attribute or the longest vector.
The other arguements are then compared to the reference to check for conformity,
which is violated if vmodes are not conforming
or if the reference has not a multiple length of each other
or if the dimensions do not match
or if we have a dimorder conflict because not all arguments have the same dimorderStandard.
Examples
a <- ff(1:10)
b <- clone(a)
c <- ff(1:20)
d <- ff(1:21)
ffconform(a,b)
#> [1] 1
#> attr(,"vmode")
#> [1] "integer"
ffconform(c,a)
#> [1] 1
#> attr(,"vmode")
#> [1] "integer"
ffconform(a,c)
#> [1] 2
#> attr(,"vmode")
#> [1] "integer"
ffconform(c,a,b)
#> [1] 1
#> attr(,"vmode")
#> [1] "integer"
d1 <- ff(1:20, dim=c(2,10))
d2 <- ff(1:20, dim=c(10,2))
ffconform(c,d1)
#> [1] 2
#> attr(,"vmode")
#> [1] "integer"
ffconform(c,d2)
#> [1] 2
#> attr(,"vmode")
#> [1] "integer"
ffconform(d1,c)
#> [1] 1
#> attr(,"vmode")
#> [1] "integer"
ffconform(d2,c)
#> [1] 1
#> attr(,"vmode")
#> [1] "integer"
try(ffconform(d1,d2))
#> Error in do.call(fail, list("non-conforming arrays")) :
#> non-conforming arrays
ffconform(d1,d1)
#> [1] 1
#> attr(,"vmode")
#> [1] "integer"
rm(a,b,c,d1,d2); gc()
#> used (Mb) gc trigger (Mb) max used (Mb)
#> Ncells 1234739 66.0 2239654 119.7 2239654 119.7
#> Vcells 2264685 17.3 8388608 64.0 5871749 44.8