Maybe you need to format the data frame as markdown before it gets displayed.
tmp %>% summary_factorlist(dependent, explanatory, p=TRUE, add_dependent_label=TRUE) %>% knitr::kable() You can also tune how the columns are formatted a bit with arguments to the kable function. On April 6, 2019 10:58:53 AM PDT, Bill Poling <bill.pol...@zelis.com> wrote: >Hello Jeff,as always, thank you for your response. > >Yes .Rmd, and here I thought I was being so thorough about providing as >much detail as possible, my apologies. > >I have an open .Rmd file from the File ->New File menu in RStudio, so I >think that part is correct. > >My code is this. >--- >title: "AutoDist Analysis" >author: "WHP" >date: "April 6, 2019" >output: > word_document: default > --- > >```{r ElegantRegress, include = FALSE} >knitr::opts_chunk$set(echo = FALSE) >``` >```{r global_options, include=FALSE} >knitr::opts_chunk$set(echo=FALSE, warning=FALSE, >message=FALSE,align=c("l", "l", "r", "r", "r", "r")) >``` > >```{r message=FALSE,warning=FALSE} >library(finalfit) >library(dplyr) >library(knitr) >library(memisc) >load("C:/WHP/Revenue Development Products//BRA >AutoDistribution/Autodist RegTests V1.RData") >setwd("C:/WHP/Revenue Development Products/BRA AutoDistribution") >``` > >```{r echo=FALSE, results='asis'} >explanatory = c("TBCat","ClaimType","drgcode2","typeofbillid2") >dependent = "Autodist2" >tmp %>% summary_factorlist(dependent, explanatory, p=TRUE, >add_dependent_label=TRUE) >``` > >I do get a word.doc file output from the above code (attachment did >not survive the communication as you mentioned) however, it is not in >the format described in the tutorial. >Here is the output I do get: > >AutoDist Analysis >WHP > >April 6, 2019 > >Dependent: Autodist2 No Yes p 5 TBCat 1 6257 (96.6) 222 (3.4) <0.001 6 >2 5780 (89.1) 709 (10.9) >7 3 5424 (83.9) 1042 (16.1) >8 4 5324 (82.2) 1156 (17.8) >9 5 5120 (79.0) 1360 (21.0) >10 6 5158 (79.6) 1322 (20.4) >11 7 5022 (77.5) 1459 (22.5) >12 8 5081 (78.4) 1398 (21.6) >13 9 4905 (75.7) 1575 (24.3) >14 10 5011 (77.3) 1469 (22.7) >1 ClaimType 1 48113 (80.6) 11566 (19.4) <0.001 2 2 4969 (97.1) 146 >(2.9) >3 drgcode2 FALSE 41015 (80.8) 9734 (19.2) <0.001 4 TRUE 12067 (85.9) >1978 (14.1) >15 typeofbillid2 FALSE 4560 (90.3) 490 (9.7) <0.001 16 TRUE 48522 >(81.2) 11222 (18.8) > >I will revisit the links you provide once again. >I have tried to find my problem solution in these earlier. >Not surprisingly given the breadth and depth of information these links >provide I have probably overlooked something nuanced yet highly >important to the formatting issue I am having. > >Once again thank you for your response Sir. > >WHP > > >From: Jeff Newmiller <jdnew...@dcn.davis.ca.us> >Sent: Saturday, April 6, 2019 10:42 AM >To: r-help@r-project.org; Bill Poling <bill.pol...@zelis.com>; r-help >(r-help@r-project.org) <r-help@r-project.org> >Subject: Re: [R] Help with use RMarkdown and knitr in an rdm output to >word.doc > >No surprise, the attachments did not come through. There are a limited >few MIME types that are allowed, but most email programs don't let you >have direct control over that, making embedding your entire >reproducible plain-text example in the main body of the email the most >sure path to successful communication on this mailing list. > >I did skim through what you wrote below, scratching my head over what >"rdm" was, until it dawned on me that you might mean a file with an >".Rmd" extension (are-mark-down) and that failing to use the correct >extension might have something to do with your failure. > >Anyway, the topic on this mailing list is the R language, and >contributed packages are (according to the Posting Guide) technically >supposed to have support resources of their own [2] listed in their >DESCRIPTION files [1]. I think the "how it works" discussion there >could be useful in clarifying which other packages rmarkdown is using >and which functions you might find useful documentation about. They >also have a community forum over there I think. > >FWIW my own experience with rmarkdown has been that that most of its >power comes from augmenting it with other packages, and those packages >are often very specific to which final output format you are using. The >Word output format is much less extensively supported than HTML or PDF >(via LaTeX) are. Don't fall into the trap of using HTML or LaTeX >features when generating Word output. > >[1] https://cran.r-project.org/web/packages/rmarkdown/index.html >[2] https://rmarkdown.rstudio.com > >On April 6, 2019 6:42:01 AM PDT, Bill Poling ><mailto:bill.pol...@zelis.com> wrote: >>Hello: >> >>#sessionInfo() >>#R version 3.5.3 (2019-03-11) >>#Platform: x86_64-w64-mingw32/x64 (64-bit) >>#Running under: Windows >= 8 x64 (build 9200) >> >>#I have been struggling with learning how to use RMarkdown and knitr >in >>an rdm while following this tutorial using my own data. >>#I Tried many months ago to self-teach but it drove me nuts, however, >I >>am now at a point where it is essential I get this figured out. >> >>#The tutorial >>#https://www.r-bloggers.com/elegant-regression-results-tables-and-plots-in-r-the-finalfit-package/ >> >>#I have googled and googled but cannot solve the problem of "how to >get >>my rdm output" word doc to look like the tutorial examples. >> >>#Many googles >>#https://stackoverflow.com/questions/20060370/in-rstudio-is-there-a-way-to-specify-a-fig-path-for-all-figures-for-this-file >>#https://rstudio.github.io/distill/figures.html >>#https://kbroman.org/knitr_knutshell/pages/Rmarkdown.html >> >>#And the list goes on. UGH! >> >>#I attach my rmd code and the word doc output, hopefully they get >>through. Please let me know, and if not how I might improvise please. >> >>#Here is the basic procedure from the tutorial which runs fine into >the >>console, however, I am trying to output it with the suggested >>formatting in the tutorial >>explanatory = c("TBCat","ClaimType","drgcode2","typeofbillid2") >>dependent = "Autodist2" >>tmp %>% >>summary_factorlist(dependent, explanatory, p=TRUE, >>add_dependent_label=TRUE) >> >>#Here is a sample of my data. >> >>#I am sure there are also basic formatting inconsistencies or >>redundancies in the rdm and would appreciate any advice or suggestion >>for that as well, happy Saturday. >> >>sample <- tmp %>% slice(1:35) >>> dput(sample) >>structure(list(Autodist2 = structure(c(2L, 2L, 2L, 2L, 2L, 2L, >>2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, >>2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("No", >>"Yes"), class = "factor"), TBCat = structure(c(4L, 10L, 6L, 8L, >>9L, 4L, 6L, 8L, 4L, 8L, 5L, 10L, 9L, 6L, 7L, 4L, 3L, 8L, 7L, >>4L, 10L, 7L, 8L, 8L, 7L, 4L, 10L, 9L, 3L, 4L, 9L, 8L, 5L, 2L, >>8L), .Label = c("1", "2", "3", "4", "5", "6", "7", "8", "9", >>"10"), class = "factor"), RestictedPayorID = structure(c(2L, >>2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, >>1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, >>2L, 2L), .Label = c("FALSE", "TRUE"), class = "factor"), ClaimType = >>structure(c(1L, >>1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, >>1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, >>1L, 1L), .Label = c("1", "2"), class = "factor"), >>ClaimStatus_Non_Acceptance = structure(c(1L, >>1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, >>2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 2L, >>1L, 1L), .Label = c("0", "1"), class = "factor"), ClaimStatus_Accepted >>= structure(c(2L, >>2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, >>1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, >>2L, 2L), .Label = c("0", "1"), class = "factor"), ClaimManagerID3 = >>structure(c(2L, >>1L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, >>2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, >>2L, 1L), .Label = c("FALSE", "TRUE"), class = "factor"), >>ClaimStatus_In_Process = structure(c(1L, >>1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, >>1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, >>1L, 1L), .Label = c("0", "1"), class = "factor"), Appeals2 = >>structure(c(2L, >>2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, >>1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, >>2L, 1L), .Label = c("FALSE", "TRUE"), class = "factor"), drgcode2 = >>structure(c(1L, >>1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, >>2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, >>1L, 1L), .Label = c("FALSE", "TRUE"), class = "factor"), edi2 = >>structure(c(1L, >>2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, >>2L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, >>2L, 1L), .Label = c("FALSE", "TRUE"), class = "factor"), typeofbillid2 >>= structure(c(2L, >>2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, >>2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, >>2L, 2L), .Label = c("FALSE", "TRUE"), class = "factor"), >>ExternalNetworkID2 = structure(c(1L, >>1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, >>1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, >>1L, 1L), .Label = c("FALSE", "TRUE"), class = "factor"), >>AdjustmentType2 = structure(c(2L, >>2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, >>2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, >>2L, 2L), .Label = c("FALSE", "TRUE"), class = "factor"), >>CustomEOPLanguage2 = structure(c(2L, >>2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, >>2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, >>2L, 2L), .Label = c("FALSE", "TRUE"), class = "factor")), row.names = >>c(NA, >>-35L), class = "data.frame") >> >> >> >>Confidentiality Notice This message is sent from Zelis. This >>transmission may contain information which is privileged and >>confidential and is intended for the personal and confidential use of >>the named recipient only. Such information may be protected by >>applicable State and Federal laws from this disclosure or unauthorized >>use. If the reader of this message is not the intended recipient, or >>the employee or agent responsible for delivering the message to the >>intended recipient, you are hereby notified that any disclosure, >>review, discussion, copying, or taking any action in reliance on the >>contents of this transmission is strictly prohibited. If you have >>received this transmission in error, please contact the sender >>immediately. Zelis, 2018. >>______________________________________________ >>mailto:R-help@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. > >Confidentiality Notice This message is sent from Zelis. This >transmission may contain information which is privileged and >confidential and is intended for the personal and confidential use of >the named recipient only. Such information may be protected by >applicable State and Federal laws from this disclosure or unauthorized >use. If the reader of this message is not the intended recipient, or >the employee or agent responsible for delivering the message to the >intended recipient, you are hereby notified that any disclosure, >review, discussion, copying, or taking any action in reliance on the >contents of this transmission is strictly prohibited. If you have >received this transmission in error, please contact the sender >immediately. Zelis, 2018. -- Sent from my phone. Please excuse my brevity. ______________________________________________ R-help@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.