Description Usage Arguments Value Author(s) Examples
Swap dimensions of a table.
1 2 |
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. |
dimDecreasing |
Logical, if swap the dimensions in a way of spread decreasing. |
preserveFirst2dim |
Fix the first 2 dimensions of the table to be a specific two dimensions of the table. |
A list of the swapped table and the new dimension order after swapping
R. Wayne Oldford and Xiaomei Yu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | table1<-c(97.62,92.24,100.90,90.39,48.29,42.31,49.98,39.09,75.23,75.16,100.11,74.23,49.69,57.21,80.19,51.09)
table1 <- matrix(table1, nrow=4,byrow=TRUE,dimnames=list(c("North" ,"South","East","West"),c("Q1","Q2","Q3","Q4")))
table1
swap(table1)
table2 <- c(.7999, .7998, .7998, .7997,
3.7999,3.7824,3.7662,3.7223,
0.3,1.2,4.9,145.7,
20.799,20.699,20.899,145.699,
35.3, 34.5,33.6,34.7)
table2 <- matrix(table2, ncol=4,byrow=TRUE,dimnames=list(c("A" ,"B","C","D","E"),c("1","2","3","4")))
swap(table2)
UCBAdmissions
swap(UCBAdmissions)
HairEyeColor
swap(HairEyeColor)
Titanic
swap(Titanic)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.