Eduardo M. A. M.Mendes
2014-Aug-02 02:36 UTC
[R] How to change print behaviour within a markdown document
Hello I have the following chunk of code within a rmarkdown document: ```{r infoA, echo=FALSE, tidy=FALSE} print(pAinfo,quote=FALSE,justify="center") ``` pAinfo is data.frame with 21 rows and 4 columns. Unfortunately the resulting html (or pdf) file does not show all the four columns together (the fourth column is placed below the first three columns) even though there is plenty of room to accommodate the last column. Is there a way to control how print or rmarkdown breaks the data.frame in order to get all four columns together? Can I somehow control the font size too? Many thanks Ed
Jeff Newmiller
2014-Aug-02 05:54 UTC
[R] How to change print behaviour within a markdown document
Use one of the various functions out there that generate markdown or html tables, and set the chunk option results='asis'. Google for "kable", "xtable", "pander", or "ascii"... there are probably others as well. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. On August 1, 2014 7:36:29 PM PDT, "Eduardo M. A. M.Mendes" <emammendes at gmail.com> wrote:>Hello > >I have the following chunk of code within a rmarkdown document: > >```{r infoA, echo=FALSE, tidy=FALSE} >print(pAinfo,quote=FALSE,justify="center") >``` >pAinfo is data.frame with 21 rows and 4 columns. Unfortunately the >resulting html (or pdf) file does not show all the four columns >together (the fourth column is placed below the first three columns) >even though there is plenty of room to accommodate the last column. > >Is there a way to control how print or rmarkdown breaks the data.frame >in order to get all four columns together? Can I somehow control the >font size too? > >Many thanks > >Ed > >______________________________________________ >R-help at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
Duncan Murdoch
2014-Aug-02 12:26 UTC
[R] How to change print behaviour within a markdown document
On 01/08/2014, 10:36 PM, Eduardo M. A. M.Mendes wrote:> Hello > > I have the following chunk of code within a rmarkdown document: > > ```{r infoA, echo=FALSE, tidy=FALSE} > print(pAinfo,quote=FALSE,justify="center") > ``` > pAinfo is data.frame with 21 rows and 4 columns. Unfortunately the resulting html (or pdf) file does not show all the four columns together (the fourth column is placed below the first three columns) even though there is plenty of room to accommodate the last column. > > Is there a way to control how print or rmarkdown breaks the data.frame in order to get all four columns together? Can I somehow control the font size too?I don't know rmarkdown, but it is probably R that is breaking the lines, based on the width option. Set options(width=80) for wider lines. The font is likely controlled by the style sheet. You need to find how rmarkdown sets that, and change it. Duncan Murdoch