r-markdown

Multiple Kable Tables with Images

牧云@^-^@ 提交于 2021-01-24 05:45:18
问题 I'm trying to create multiple tables using kable from a csv file, but the requirement is that I need to also put an image in the table as per the below image. The entire image needs to be in the left column. Is this possible? The dataframe looks like this: df<-data.frame(Amount= c('$25', '$45', '$75'), Rate = c('1%', '1%', '3%'), Location = c('Germany', 'Switzerland', 'England'), ImageName= c('GE.png', 'BE.png', 'CE.png'), Status = c('Sold','Unsold','Sold') ) So far my R code is --- output:

Multiple Kable Tables with Images

二次信任 提交于 2021-01-24 05:45:15
问题 I'm trying to create multiple tables using kable from a csv file, but the requirement is that I need to also put an image in the table as per the below image. The entire image needs to be in the left column. Is this possible? The dataframe looks like this: df<-data.frame(Amount= c('$25', '$45', '$75'), Rate = c('1%', '1%', '3%'), Location = c('Germany', 'Switzerland', 'England'), ImageName= c('GE.png', 'BE.png', 'CE.png'), Status = c('Sold','Unsold','Sold') ) So far my R code is --- output:

incorporate code listings from an external file in knitr/markdown

ⅰ亾dé卋堺 提交于 2021-01-22 06:55:17
问题 I would like to incorporate listings of code drawn from external files in an Rmarkdown file. I would like it pretty (syntax highlighting, auto-indentation, etc.). The code is not R code (otherwise I could use some of the existing tricks to pretty-print R functions) - specifically, it's BUGS and Stan code. I'm not necessarily targeting LaTeX/PDF output: otherwise I could use the listings package. I'd like to be able to incorporate the files without an unwieldy external cat firstpart.rmd

incorporate code listings from an external file in knitr/markdown

痴心易碎 提交于 2021-01-22 06:54:48
问题 I would like to incorporate listings of code drawn from external files in an Rmarkdown file. I would like it pretty (syntax highlighting, auto-indentation, etc.). The code is not R code (otherwise I could use some of the existing tricks to pretty-print R functions) - specifically, it's BUGS and Stan code. I'm not necessarily targeting LaTeX/PDF output: otherwise I could use the listings package. I'd like to be able to incorporate the files without an unwieldy external cat firstpart.rmd

How can I format sessionInfo() in rmarkdown?

风格不统一 提交于 2021-01-21 04:14:19
问题 If I want to nicely print my sessionInfo in R for a PDF, I can just use toLatex(sessionInfo()) It seems like there should be a similar option for rmarkdown to render in HTML, but I can't find it here or on Rdocumentation. Before re-inventing the wheel, thought I'd ask if the equivalent of toMarkdown(sessionInfo()) already exists. 回答1: Try pander , which is a general method to do the R->markdown conversion: > pander(sessionInfo()) **R version 3.2.1 (2015-06-18)** **Platform:** x86_64-unknown

Reticulate - Running python chunks in Rmarkdown

烈酒焚心 提交于 2021-01-21 01:38:35
问题 Maybe I'm missing something, but if the following code is the content of my Rmd file ```{r} library(reticulate) use_virtualenv("r-reticulate") py_available(TRUE) ``` ```{python} a = 7 print(a) ``` ```{r} py$a ``` when I Knit the file, the output for the last chunk is 7 (as expected). On the other hand, clicking the run all button in Rstudio (or running chunks one by one), results on NULL for the last chunk. Comparing with the R notebook example it seems like assigning something to flights in

Reticulate - Running python chunks in Rmarkdown

扶醉桌前 提交于 2021-01-21 01:37:03
问题 Maybe I'm missing something, but if the following code is the content of my Rmd file ```{r} library(reticulate) use_virtualenv("r-reticulate") py_available(TRUE) ``` ```{python} a = 7 print(a) ``` ```{r} py$a ``` when I Knit the file, the output for the last chunk is 7 (as expected). On the other hand, clicking the run all button in Rstudio (or running chunks one by one), results on NULL for the last chunk. Comparing with the R notebook example it seems like assigning something to flights in

How to produce a PDF title page from an R Markdown document

余生长醉 提交于 2021-01-20 13:46:02
问题 I would like to produce a custom title page when I knit my R Markdown document to pdf. Here are the contents of my R Markdown document: --- output: pdf_document: template: template.tex --- # abstract this is just some text And here are the contents of template.tex: \begin{document} \maketitle \end{document} When I knit to pdf none of the R Markdown text appears. Only the template does. Could anyone explain how I could type in R Markdown after using a latex template? 回答1: Your R Markdown

How to produce a PDF title page from an R Markdown document

半世苍凉 提交于 2021-01-20 13:45:47
问题 I would like to produce a custom title page when I knit my R Markdown document to pdf. Here are the contents of my R Markdown document: --- output: pdf_document: template: template.tex --- # abstract this is just some text And here are the contents of template.tex: \begin{document} \maketitle \end{document} When I knit to pdf none of the R Markdown text appears. Only the template does. Could anyone explain how I could type in R Markdown after using a latex template? 回答1: Your R Markdown

RMarkdown automatic anchor-section

杀马特。学长 韩版系。学妹 提交于 2021-01-19 08:59:26
问题 Well, I've been working with Markdown for a year and today, suddenly, next to the headings an a tag has been automatically added. Someone would know why these anchors have been generated automatically and how I could remove them? Pd: one way to solve it is with h1,h2, etc., but then with the pdf output the index is eliminated, so it would not really solve the problem. 回答1: This is a new feature in rmarkdown 2.5. You can change this in your YAML header at the top of your rmd file: html