dToCount.Rd {DoE.MIParray} | R Documentation |
dToCount rearranges an array into count vector format. countToDmixed rearranges a count vector representation into an array.
dToCount(d, nlevels=NULL, startfrom1=FALSE)
countToDmixed(nlevels, count)
ff(...)
d |
an array (matrix with runs as rows and factors as columns) |
nlevels |
vector of integers (>=2); numbers of factor levels |
startfrom1 |
logical; if TRUE, values are from 1 to |
count |
vector of |
... |
vector of integers (>=2) or the integers themselves, separated by commata |
dToCount
transforms an array into count representation. If all array columns contain all potential factor levels, nlevels does not need to be specified. Otherwise, nlevels
is needed.
countToDmixed
transforms the count representation of an array (counts refer to the rows of ff(nlevels)
) into an array
dToCount
produces a vector of length prod(nlevels)
,
countToDmixed
produces a matrix with sum(count)
rows and length(nlevels)
columns,
countToDmixed
produces a matrix with prod(nlevels)
rows and length(nlevels)
columns.
The size of the full factorial design (produced with ff
) is a limiting factor for using the functionality of this package.
Ulrike Groemping
Groemping, U. (2020). DoE.MIParray: an R package for algorithmic creation of orthogonal arrays. Journal of Open Research Software, 8: 24. DOI: https://doi.org/10.5334/jors.286
d <- ff(c(2,2,4))[1:6,] ## first six rows of the full factorial only
d
## the count vector must have 2*2*4=16 elements,
## the first six must be 1, the last ten must be zero
dToCount(d) ## does not produce the desired result,
## because the first column of d
## does not contain both levels
(d_as_count <- dToCount(d, nlevels=c(2,2,4)))
## corresponds to the above way of creating d
dToCount(d, nlevels=c(2,2,5)) ## would correspond to a different reality,
## where the third factor has in fact 5 levels,
## of which only four are in the array
countToDmixed(c(2,2,4), d_as_count)
## creates d from the count representation