REMOVING THE MATRIX ROW AND COLUMNS
I somehow edited the code of 42- above to address the problem of removing the matrix row and column indices by creating a modification of the print
function. Here's the code:
pdfrm <- function(dfrm) { # first print the names broken into sections
mprint <- function(Mn){
rownames(Mn) <- rep("",nrow(Mn))
colnames(Mn) <- rep("",ncol(M))
print(as.table(Mn),quote=FALSE,print.gap=8)
}
mprint(unname(
t(sapply( 1:(max(nchar(names(dfrm))) %/% 12),
# first construct break points to be passed to `substr`
function(rr) sapply(names(dfrm), substr, 1+(rr-1)*10, 9+(rr-1)*10) ) )))
# Now print a headerless data.frame with wider spacing
print( setNames(dfrm, rep(" ", length(dfrm))), print.gap = 15 )
}
pdfrm(dfrm)
and it ouputs the following:
reallly_l secondrea short
ng.nameee lly_long.
eeeeeeeee ameeeeeee
1 a a 2
2 b b 2
3 c c 2
4 d d 2
5 e e 2
The above code could be modified so that it can take care of arbitrary and adaptive spacing.