ttbl <- textTable(iris2_tab)
plot(ttbl)
# Remove the first column header row ("Flower part"), and reverse the
# order of the "Sepal" and "Petal" sets of columns:
subttbl <- ttbl[-1, c(1,2,5,6,3,4)]
plot(subttbl)
# Use helper functions 'arow', 'acol' to specify indices based on
# table structure:
i <- arow(ttbl, "colhead")[1] # row number of first column header row
j1 <- acol(ttbl, "rowhead") # column numbers for row header
j2 <- acol(ttbl, "colhead") # column numbers for column header
subttbl2 <- ttbl[-i, c(j1, j2[c(3,4,1,2)])]
identical(subttbl, subttbl2)
Run the code above in your browser using DataLab