# ----------
# Example 1)
# ----------
x <- array(
c(1,0,0,2,3,4,0,0),
dim = c(2,2,2),
dimnames = list(
a = c("a1", "a2"),
b = c("b1", "b2"),
c = c("c1", "c2")
)
)
as_sparta(x)
# ----------
# Example 2)
# ----------
y <- mtcars[, c("gear", "carb")]
y[] <- lapply(y, as.character)
as_sparta(y)
Run the code above in your browser using DataLab