I am relatively new to R and was wondering if someone could advise me on presenting tables in R Markdown for Word. I would like to present a simple table of counts, with column 1 representing name of an organisation (and last row called "All organisations") and another four columns representing the most recent four week period (e.g. week 21, 22, 23, 24) and a final total column, as illustrated below. The actual data is just counts (e.g. 4, 5, 8, widgets produced, number of people off sick etc). My question is: can this be done to a publication quality standard. I have tried Pander, but that adds "Sum" instead of All Organisations and 4 Week Total and doesn't look particularly good. Week 20 21 22 23 4 week total Organisation 6 6 1 1 14 ABC 2 4 1 5 12 DCE 0 5 1 5 11 EFG 3 6 3 5 17 HIJ 1 8 3 2 14 All Organizations 12 29 9 18 68 Kind regards, Shakeel ************************************************************************** The information contained in the EMail and any attachments is confidential and intended solely and for the attention and use of the named addressee(s). It may not be disclosed to any other person without the express authority of Public Health England, or the intended recipient, or both. If you are not the intended recipient, you must not disclose, copy, distribute or retain this message or any part of it. This footnote also confirms that this EMail has been swept for computer viruses by Symantec.Cloud, but please re-sweep any attachments before opening or saving. http://www.gov.uk/PHE ************************************************************************** [[alternative HTML version deleted]]
You should post this on the r-package-devel list, not here. That list is exactly concerned with such issues. This list is about R programming itself. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Jun 13, 2018 at 12:05 AM, Shakeel Suleman < Shakeel.Suleman at phe.gov.uk> wrote:> I am relatively new to R and was wondering if someone could advise me on > presenting tables in R Markdown for Word. I would like to present a simple > table of counts, with column 1 representing name of an organisation (and > last row called "All organisations") and another four columns representing > the most recent four week period (e.g. week 21, 22, 23, 24) and a final > total column, as illustrated below. The actual data is just counts (e.g. 4, > 5, 8, widgets produced, number of people off sick etc). > > My question is: can this be done to a publication quality standard. I have > tried Pander, but that adds "Sum" instead of All Organisations and 4 Week > Total and doesn't look particularly good. > > > > Week > > > > 20 > > 21 > > 22 > > 23 > > 4 week total > > Organisation > > 6 > > 6 > > 1 > > 1 > > 14 > > ABC > > 2 > > 4 > > 1 > > 5 > > 12 > > DCE > > 0 > > 5 > > 1 > > 5 > > 11 > > EFG > > 3 > > 6 > > 3 > > 5 > > 17 > > HIJ > > 1 > > 8 > > 3 > > 2 > > 14 > > All Organizations > > 12 > > 29 > > 9 > > 18 > > 68 > > > > Kind regards, > > Shakeel > > > ************************************************************************** > The information contained in the EMail and any attachments is confidential > and intended solely and for the attention and use of the named > addressee(s). It may not be disclosed to any other person without the > express authority of Public Health England, or the intended recipient, or > both. If you are not the intended recipient, you must not disclose, copy, > distribute or retain this message or any part of it. This footnote also > confirms that this EMail has been swept for computer viruses by > Symantec.Cloud, but please re-sweep any attachments before opening or > saving. http://www.gov.uk/PHE > ************************************************************************** > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]
On 13/06/2018 10:10 AM, Bert Gunter wrote:> You should post this on the r-package-devel list, not here. That list is > exactly concerned with such issues. This list is about R programming itself.No, r-package-devel is about developing and publishing R packages, not using them. I don't know the answer to this question. Others like it tend to appear on Stack Overflow with the "knitr" tag, so that might be a better place to ask if no answer appears here. But like here, that forum asks for reproducible examples (i.e. the R code that doesn't quite work). Duncan Murdoch> > Cheers, > Bert > > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > On Wed, Jun 13, 2018 at 12:05 AM, Shakeel Suleman < > Shakeel.Suleman at phe.gov.uk> wrote: > >> I am relatively new to R and was wondering if someone could advise me on >> presenting tables in R Markdown for Word. I would like to present a simple >> table of counts, with column 1 representing name of an organisation (and >> last row called "All organisations") and another four columns representing >> the most recent four week period (e.g. week 21, 22, 23, 24) and a final >> total column, as illustrated below. The actual data is just counts (e.g. 4, >> 5, 8, widgets produced, number of people off sick etc). >> >> My question is: can this be done to a publication quality standard. I have >> tried Pander, but that adds "Sum" instead of All Organisations and 4 Week >> Total and doesn't look particularly good. >> >> >> >> Week >> >> >> >> 20 >> >> 21 >> >> 22 >> >> 23 >> >> 4 week total >> >> Organisation >> >> 6 >> >> 6 >> >> 1 >> >> 1 >> >> 14 >> >> ABC >> >> 2 >> >> 4 >> >> 1 >> >> 5 >> >> 12 >> >> DCE >> >> 0 >> >> 5 >> >> 1 >> >> 5 >> >> 11 >> >> EFG >> >> 3 >> >> 6 >> >> 3 >> >> 5 >> >> 17 >> >> HIJ >> >> 1 >> >> 8 >> >> 3 >> >> 2 >> >> 14 >> >> All Organizations >> >> 12 >> >> 29 >> >> 9 >> >> 18 >> >> 68 >> >> >> >> Kind regards, >> >> Shakeel >> >> >> ************************************************************************** >> The information contained in the EMail and any attachments is confidential >> and intended solely and for the attention and use of the named >> addressee(s). It may not be disclosed to any other person without the >> express authority of Public Health England, or the intended recipient, or >> both. If you are not the intended recipient, you must not disclose, copy, >> distribute or retain this message or any part of it. This footnote also >> confirms that this EMail has been swept for computer viruses by >> Symantec.Cloud, but please re-sweep any attachments before opening or >> saving. http://www.gov.uk/PHE >> ************************************************************************** >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >
Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) ---------- Forwarded message ---------- From: Bert Gunter <bgunter.4567 at gmail.com> Date: Wed, Jun 13, 2018 at 8:11 AM Subject: Re: [R] Tables in Rmarkdown Word To: Duncan Murdoch <murdoch.duncan at gmail.com> Duncan: OK. I'll stand corrected. A web search on "Rmarkdown tables" produced what looked like several useful links, e.g. https://rmarkdown.rstudio.com/lesson-7.html Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Jun 13, 2018 at 7:31 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:> On 13/06/2018 10:10 AM, Bert Gunter wrote: > >> You should post this on the r-package-devel list, not here. That list is >> exactly concerned with such issues. This list is about R programming >> itself. >> > > No, r-package-devel is about developing and publishing R packages, not > using them. > > I don't know the answer to this question. Others like it tend to appear > on Stack Overflow with the "knitr" tag, so that might be a better place to > ask if no answer appears here. But like here, that forum asks for > reproducible examples (i.e. the R code that doesn't quite work). > > Duncan Murdoch > > > >> Cheers, >> Bert >> >> >> >> Bert Gunter >> >> "The trouble with having an open mind is that people keep coming along and >> sticking things into it." >> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) >> >> On Wed, Jun 13, 2018 at 12:05 AM, Shakeel Suleman < >> Shakeel.Suleman at phe.gov.uk> wrote: >> >> I am relatively new to R and was wondering if someone could advise me on >>> presenting tables in R Markdown for Word. I would like to present a >>> simple >>> table of counts, with column 1 representing name of an organisation (and >>> last row called "All organisations") and another four columns >>> representing >>> the most recent four week period (e.g. week 21, 22, 23, 24) and a final >>> total column, as illustrated below. The actual data is just counts (e.g. >>> 4, >>> 5, 8, widgets produced, number of people off sick etc). >>> >>> My question is: can this be done to a publication quality standard. I >>> have >>> tried Pander, but that adds "Sum" instead of All Organisations and 4 Week >>> Total and doesn't look particularly good. >>> >>> >>> >>> Week >>> >>> >>> >>> 20 >>> >>> 21 >>> >>> 22 >>> >>> 23 >>> >>> 4 week total >>> >>> Organisation >>> >>> 6 >>> >>> 6 >>> >>> 1 >>> >>> 1 >>> >>> 14 >>> >>> ABC >>> >>> 2 >>> >>> 4 >>> >>> 1 >>> >>> 5 >>> >>> 12 >>> >>> DCE >>> >>> 0 >>> >>> 5 >>> >>> 1 >>> >>> 5 >>> >>> 11 >>> >>> EFG >>> >>> 3 >>> >>> 6 >>> >>> 3 >>> >>> 5 >>> >>> 17 >>> >>> HIJ >>> >>> 1 >>> >>> 8 >>> >>> 3 >>> >>> 2 >>> >>> 14 >>> >>> All Organizations >>> >>> 12 >>> >>> 29 >>> >>> 9 >>> >>> 18 >>> >>> 68 >>> >>> >>> >>> Kind regards, >>> >>> Shakeel >>> >>> >>> ************************************************************ >>> ************** >>> The information contained in the EMail and any attachments is >>> confidential >>> and intended solely and for the attention and use of the named >>> addressee(s). It may not be disclosed to any other person without the >>> express authority of Public Health England, or the intended recipient, or >>> both. If you are not the intended recipient, you must not disclose, copy, >>> distribute or retain this message or any part of it. This footnote also >>> confirms that this EMail has been swept for computer viruses by >>> Symantec.Cloud, but please re-sweep any attachments before opening or >>> saving. http://www.gov.uk/PHE >>> ************************************************************ >>> ************** >>> [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> 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. >>> >>> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posti >> ng-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> >[[alternative HTML version deleted]]
I have heard of people using CSS formatting with Rmarkdown output and copy-pasting into Word/LibreOffice, but LaTeX is so much nicer if you don't require Word that I suppose there haven't been many with that itch. To some extent you can use a manually-styled Word starting document (referred to as a template but not what Word refers to as a template) with Word output, but that is pretty limited for table formatting. You could look at the ReporteRs package instead... but that is not Rmarkdown. If you really need publication quality with Word On June 12, 2018 9:05:55 PM HST, Shakeel Suleman <Shakeel.Suleman at phe.gov.uk> wrote:>I am relatively new to R and was wondering if someone could advise me >on presenting tables in R Markdown for Word. I would like to present a >simple table of counts, with column 1 representing name of an >organisation (and last row called "All organisations") and another four >columns representing the most recent four week period (e.g. week 21, >22, 23, 24) and a final total column, as illustrated below. The actual >data is just counts (e.g. 4, 5, 8, widgets produced, number of people >off sick etc). > >My question is: can this be done to a publication quality standard. I >have tried Pander, but that adds "Sum" instead of All Organisations and >4 Week Total and doesn't look particularly good. > > > >Week > > > >20 > >21 > >22 > >23 > >4 week total > >Organisation > >6 > >6 > >1 > >1 > >14 > >ABC > >2 > >4 > >1 > >5 > >12 > >DCE > >0 > >5 > >1 > >5 > >11 > >EFG > >3 > >6 > >3 > >5 > >17 > >HIJ > >1 > >8 > >3 > >2 > >14 > >All Organizations > >12 > >29 > >9 > >18 > >68 > > > >Kind regards, > >Shakeel > > >************************************************************************** >The information contained in the EMail and any attachments is >confidential and intended solely and for the attention and use of the >named addressee(s). It may not be disclosed to any other person without >the express authority of Public Health England, or the intended >recipient, or both. If you are not the intended recipient, you must not >disclose, copy, distribute or retain this message or any part of it. >This footnote also confirms that this EMail has been swept for computer >viruses by Symantec.Cloud, but please re-sweep any attachments before >opening or saving. http://www.gov.uk/PHE >************************************************************************** > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.-- Sent from my phone. Please excuse my brevity.