Let's say you have a matrix defined as
m1 = matrix(
rbind(c(12,8,9),c(4100,3600,3200)),
byrow=FALSE,
nrow=2,
ncol=3,
dimnames=list(c("Days","Amount"),c("Col1","Col2","Col3"))
)
Which yields:
Col1 Col2 Col3
Days 12 8 9
Amount 4100 3600 3200
And you need to show (knowing the position of the column, here 3) name of the column and its values, so that you have information about the parameters like:
Days Amount
9 3200
But you also need to know the column name which carries some real information about its values (ie hotel name).
The above you could achieve with m1[, 3]
like in this question, but how does one print it together with the column header? (here "Col3")