Description Usage Arguments Value Note Author(s) Examples
Get a summary of a dimension/combination of dimensions.
1 2 | chooseValue(table, chooseFun = "median", valueFun = "mad", comleft = NULL,
com = NULL, column = 1)
|
table |
A sample of data with dimensions >=2, can be a matrix, an array or a table. |
chooseFun |
The summary to represent the variability (spread) of each dimension/combination of dimensions, can be functions in R or self-defined functions. |
valueFun |
The summary to measure the variability (spread) of each layer of the dimension/combination of dimensions, can be functions in R or self-defined functions. |
comleft |
A matrix of combinations of dimensions, each column stores the dimensions of a combination. |
com |
A matrix of all the layer combinations of the dimensions in the combination combination. Each column stores a combination of layers e.g. The dimensions in a combination is (2,4,1), if the first column of com is (1,2,4), this means the layer combination is the first layer of the second dimension and the second layer of the fourth dimension and the fourth layer of the first dimension. |
column |
The column of comleft which we want to apply our chooseValue() to, the default is 1. |
The summary of the dimension/combination of dimensions
Here, the default of chooseFun is "median" and the default of valueFun is "mad" since in our tidytable package we define the varaibility of a dimension (combination of dimensions) as the median of mad values get from each layer of that dimension (combination).
R. Wayne Oldford and Xiaomei Yu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | table <- Titanic
comleft <- combn(length(dim(table)), 2) # all the combinations of two dimensions
comleft <- matrix(comleft, ncol = dim(comleft)[2])
# Get the summary of the second combination (second column of comleft), i.e. (1,3)
# use expand.grid() to get all the layer combinations
excom <- mapply(function(i){
paste('1:dim(table)[comleft[', i, ',2]]')
},
1:dim(comleft)[1]
)
com <- eval(parse(text = paste('expand.grid(',
paste(excom, collapse = ","),
')',
sep = ''
)
)
)
chooseValue(table, chooseFun = "median", valueFun="mad", comleft, com, column=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.