I have a 3d-array "arr" in R:
> v1 <- c("100", "75", "31", "41", "1000", "69")
> v2 <- c("10m", "6h", "5d", "11m", "6h", "5d")
> arr <- array(c(v1, v2), dim=c(3, 2, 2), dimnames=list(c("d1", "d2", "d3"), c("m1", "m2"), c("v1", "v2")))
> arr
, , v1
m1 m2
d1 "100" "41"
d2 "75" "1000"
d3 "31" "69"
, , v2
m1 m2
d1 "10m" "11m"
d2 "6h" "6h"
d3 "5d" "5d"
which I want to create a Latex table for it that will looks like:
m1 m2
------------------------------
v1 v2 v1 v2
------------------------------
d1 100 10m 41 11m
d2 75 6h 1000 6h
d3 31 5d 69 5d
How can I use R to make a table like the above into latex? I know the R package "xtable" can do similar things that I need. However, I don't know if it can make the exact table above for me.
PS: I also wonder if there are other ways to present a 3d-array in a table besides that presented above.