How to print (to paper) a nicely-formatted data frame

后端 未结 10 2037
深忆病人
深忆病人 2020-12-07 08:41

I\'d like to print nicely-formatted data frames to paper, ideally from within a script. (I am trying to collect data using an instrument and automatically process and print

10条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 09:02

    For long/wide tables you could use pander.

    It will automatically split long tables into shorter parts that fit the page, e.g. using knitr insert this chunk into your Rmd file:

    pander::pander(mtcars)
    

    If you want something that looks more like Excel tables (even with editing options in html) then use rhandsontable. More info about usage and formatting in the vignette. You will need to knit your Rmd into an html file:

    library(rhandsontable)
    rhandsontable(mtcars, rowHeaders = NULL)
    

提交回复
热议问题