expected <- structure(c(0.124248979591837, 0.0992163265306122, 0.0163551020408163, 
0.010330612244898, 0.0992163265306122, 0.143689795918367, 0.0116979591836735, 
0.00929795918367347, 0.0163551020408163, 0.0116979591836735, 
0.0301591836734694, 0.00606938775510204, 0.010330612244898, 0.00929795918367347, 
0.00606938775510204, 0.0111061224489796, 0.266432653061224, 0.0851836734693878, 
0.182897959183673, 0.0557795918367347, 0.0851836734693878, 0.098469387755102, 
0.0826530612244898, 0.0412040816326531, 0.182897959183673, 0.0826530612244898, 
0.220816326530612, 0.0731020408163265, 0.0557795918367347, 0.0412040816326531, 
0.0731020408163265, 0.0391061224489796, 0.404342857142857, 0.0937632653061225, 
0.303289795918367, 0.0490938775510204, 0.0937632653061225, 0.104004081632653, 
0.0713795918367347, 0.0476285714285714, 0.303289795918367, 0.0713795918367347, 
0.304587755102041, 0.0488244897959184, 0.0490938775510204, 0.0476285714285714, 
0.0488244897959184, 0.0754326530612245), .Dim = c(4L, 4L, 3L), .Dimnames = structure(list(
    c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"
    ), c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"
    ), Species = c("setosa", "versicolor", "virginica")), .Names = c("", 
"", "Species")))
test(id=0, code={
argv <- structure(list(a = structure(c(0.124248979591837, 0.266432653061224, 
0.404342857142857, 0.0992163265306122, 0.0851836734693878, 0.0937632653061225, 
0.0163551020408163, 0.182897959183673, 0.303289795918367, 0.010330612244898, 
0.0557795918367347, 0.0490938775510204, 0.0992163265306122, 0.0851836734693878, 
0.0937632653061225, 0.143689795918367, 0.098469387755102, 0.104004081632653, 
0.0116979591836735, 0.0826530612244898, 0.0713795918367347, 0.00929795918367347, 
0.0412040816326531, 0.0476285714285714, 0.0163551020408163, 0.182897959183673, 
0.303289795918367, 0.0116979591836735, 0.0826530612244898, 0.0713795918367347, 
0.0301591836734694, 0.220816326530612, 0.304587755102041, 0.00606938775510204, 
0.0731020408163265, 0.0488244897959184, 0.010330612244898, 0.0557795918367347, 
0.0490938775510204, 0.00929795918367347, 0.0412040816326531, 
0.0476285714285714, 0.00606938775510204, 0.0731020408163265, 
0.0488244897959184, 0.0111061224489796, 0.0391061224489796, 0.0754326530612245
), .Dim = c(3L, 4L, 4L), .Dimnames = structure(list(Species = c("setosa", 
"versicolor", "virginica"), c("Sepal.Length", "Sepal.Width", 
"Petal.Length", "Petal.Width"), c("Sepal.Length", "Sepal.Width", 
"Petal.Length", "Petal.Width")), .Names = c("Species", "", ""
))), perm = c(2, 3, 1)), .Names = c("a", "perm"))
do.call('aperm', argv);
},  o = expected);

