r-markdown

How to include Google Analytics in an RMarkdown generated GitHub Page?

烂漫一生 提交于 2020-06-10 03:04:28
问题 How can I always include the Google Analytics tacking code on my GitHub Pages webpage generated with R Markdown? I am currently creating a webpage hosted on GitHub Pages using RMarkdown. To create site, I run rmarkdown::render_site() . This command will knit all R Markdown documents to create the relevant .html files. However, I want to include Google Analytics on my site. To do this, I need to include a University Analytics tracking code to my property by pasting the JavaScript code in my

Replace column names in kable/R markdown

谁说胖子不能爱 提交于 2020-06-10 02:59:05
问题 My data frame has ugly column names, but when displaying the table in my report, I want to their "real" names including special characters '(', new lines, greek letters, repeated names, etc. Is there an easy way of replacing the names in knitr to allow such formatting? Proposed solution What I have tried to do is suppress the printing of the data frame names and use add_header_above for better names and names that span several columns. Some advice I've seen says to use: x <- kable(df) gsub("

coloring tabs in rmarkdown

余生颓废 提交于 2020-06-01 12:41:11
问题 consider the following rmarkdown file: --- title: "tab colors" output: html_document: self_contained: no --- <style> .nav>li>a { position: relative; display: block; padding: 10px 15px; color: #990000; } .nav-pills>li.active>a, .nav-pills>li.active>a:hover, .nav-pills>li.active>a:focus { color: #ffffff; background-color: #990000; } </style> #{.tabset .tabset-fade .tabset-pills} ##Tab red Tab red ##Tab green Tab green I was able to change the color of all tabs by adding some css in the

coloring tabs in rmarkdown

邮差的信 提交于 2020-06-01 12:40:34
问题 consider the following rmarkdown file: --- title: "tab colors" output: html_document: self_contained: no --- <style> .nav>li>a { position: relative; display: block; padding: 10px 15px; color: #990000; } .nav-pills>li.active>a, .nav-pills>li.active>a:hover, .nav-pills>li.active>a:focus { color: #ffffff; background-color: #990000; } </style> #{.tabset .tabset-fade .tabset-pills} ##Tab red Tab red ##Tab green Tab green I was able to change the color of all tabs by adding some css in the

R Markdown: Remove tabset configuration when rendering

 ̄綄美尐妖づ 提交于 2020-06-01 07:40:12
问题 I have the following question: I am creating an HTML document using RMD and html_document. I use tabset and tabset-pills to structure the content. My question now is: Can I render the same RMD document but do not interprete the tabset settings? To provide an example: Can I render this RMD file resulting in the two different outputs below? --- output: html_document --- # Headline 1 ## Headline 2 {.tabset} ### Headline 3 in a tab ### Headline 4 in a tab ### Headline 5 in a tab Thanks Stephan

How to display a list of chorddiag plot swhen using dynamically generated tabs?

可紊 提交于 2020-06-01 05:08:17
问题 I want to dynamically generate tabs, and each tab plot the corddiag plot library(igraph) library(tidygraph) library(chorddiag) m <- matrix(c(11975, 5871, 8916, 2868, 1951, 10048, 2060, 6171, 8010, 16145, 8090, 8045, 1013, 990, 940, 6907), byrow = TRUE, nrow = 4, ncol = 4) groupnames <- c("black", "blonde", "brown", "red") row.names(m) <- groupnames colnames(m) <- groupnames m is just some corddiag plot I use for simplicity. I have different plots on each page based on a different dataset. So

RMarkdown and ggplotly

北慕城南 提交于 2020-05-30 03:52:06
问题 I am wishing to create an interactive figure to send to a co-worker, who does not have nor use R. The figure that I am creating contains confidential data. I am a beginner at using ggplotly and understand interactive figures can be posted online, however, I don't wish for this figure to be publicly available. I have been using the offline plotting version. I understand interactive reports, including plotly figures, can be compiled using R Markdown. However, if I run this plot in R and create

! LaTeX Error: Environment threeparttable undefined

前提是你 提交于 2020-05-29 07:40:07
问题 When using R Markdown to create a pdf a get this error: output file: NCERA-210_Results.knit.md ! LaTeX Error: Environment threeparttable undefined. Error: Failed to compile NCERA-210_Results.tex. See NCERA-210_Results.log for more info. In addition: There were 50 or more warnings (use warnings() to see the first 50) Execution halted My code is: --- title: "NCERA-210 Results" author: "NAME" date: "8/29/2018" output: pdf_document --- ```{r setup, echo=FALSE, results="asis", message=FALSE,

How can I center image in R markdown in knit word

烈酒焚心 提交于 2020-05-27 12:13:20
问题 I want to center image in R markdown in knit word. I search result almost is CSSor HTML code. But I need center image in word. This my code ![avatar](C:/Users/user/Desktop/picture1.jpg){ width=5cm } Thanks! 回答1: I encountered the same problem and managed to solve it using a .docx file template that I declared at the beginning of the document: --- output: word_document: reference_docx: template.docx --- Just open your template file, select a figure, then press Ctrl + Shift + s to display the

How can I center image in R markdown in knit word

我怕爱的太早我们不能终老 提交于 2020-05-27 12:12:33
问题 I want to center image in R markdown in knit word. I search result almost is CSSor HTML code. But I need center image in word. This my code ![avatar](C:/Users/user/Desktop/picture1.jpg){ width=5cm } Thanks! 回答1: I encountered the same problem and managed to solve it using a .docx file template that I declared at the beginning of the document: --- output: word_document: reference_docx: template.docx --- Just open your template file, select a figure, then press Ctrl + Shift + s to display the