[R] Help with use RMarkdown and knitr in an rdm output to word.doc

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Sat Apr 6 16:42:06 CEST 2019


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 <Bill.Poling using 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.
>______________________________________________
>R-help using 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.



More information about the R-help mailing list