Hello, I wonder if it's possible to put names above column names. Do you know if it's possible? thanks. ___________________________________________________________________________ [[alternative HTML version deleted]]
elyakhlifi mustapha wrote:> Hello, > I wonder if it's possible to put names above column names. > Do you know if it's possible?If you mean something like this: Weekdays Monday Tuesday Wednesday Thursday Friday and you want it to be part of the data frame: attr(mydf,"supername")<-"Weekdays" This will not just appear when you print the data frame, you would have to access the "supername" like this: attr(mydf,"supername") [1] "Weekdays" However, I suspect that whatever you are trying to accomplish can be done in a more straightforward way. Jim
If your data.frame is entirely numeric, then you could design a print function that builds on this example of converting it to a data.matrix: mydf <- data.frame(Mon=1:3, Tue=4:6, Wed=7:9, Thu=10:12, Fri=13:15) mydm <- data.matrix(mydf) names(dimnames(mydm)) <- c("", "Weekdays") mydm data.frame(mydm) ## loses names(dimnames)