1

While trying to answer THIS SO question, I came across a curious problem with a large dataframe (DF). I wanted to print the DF row-by-row, but for some reason it insists in printing the DF in a column-by-column fashion and I am not able to find a way to print the whole thing in a nice way, to get the formatting I would like to see (and preferably be able to scroll through), without considerable performance loss.

The following behave differently, depending on the length of the DF columns. When small it looks great and works as expected, but when large, it prints column-by-column (or doesn't align when using different methods). The R-package DF is 13022 rows long.

# Please see: https://stackoverflow.com/a/52227315/1147688
print(mdf, right=FALSE, row.names=FALSE)

# PackageName Description                                                             
# A3          Accurate, Adaptable, and Accessible Error Metrics for Predictive\nModels
# abbyyR      Access to Abbyy Optical Character Recognition (OCR) API                 
# abc         Tools for Approximate Bayesian Computation (ABC)                        
# abc.data    Data Only: Tools for Approximate Bayesian Computation (ABC)             
# ABC.RAP     Array Based CpG Region Analysis Pipeline                                
# ABCanalysis Computed ABC Analysis

Q: Any ideas how to do this natively without having to resort to looping over indexes?

PS. I am already aware of the related suggestions here.

not2qubit
  • 14,531
  • 8
  • 95
  • 135

0 Answers0