r-markdown

Graphing matplotlib with Python code in a R Markdown document

混江龙づ霸主 提交于 2019-12-04 23:39:00
Is it possible to use Python matplotlib code to draw graph in RStudio? e.g. below Python matplotlib code: import numpy as np import matplotlib.pyplot as plt n = 256 X = np.linspace(-np.pi,np.pi,n,endpoint=True) Y = np.sin(2*X) plt.plot (X, Y+1, color='blue', alpha=1.00) plt.plot (X, Y-1, color='blue', alpha=1.00) plt.show() Output graph will be: Then I need to write a R Markdown to include these code and generate graph automatically after knitting the markdown. One possible solution is save the plot as a image, then load the file to markdown. ### Call python code sample ```{r,engine='python'}

Mass create documents in R markdown

拈花ヽ惹草 提交于 2019-12-04 22:47:35
问题 I'm wondering if anyone can help me with a dilemma I'm having. I have a dataset of around 300 individuals that contains some basic information about them (e.g. age, gender). I want to knit a separate R markdown report for each individual that details this basic information, in Word format. And then I want to save each report with their unique name. The actual code which sits behind the report doesn't change, only the details of each individual. For example: Report 1: "Sally is a female who is

Is it possible to include svg image in pdf document rendered by rmarkdown?

感情迁移 提交于 2019-12-04 22:04:06
问题 I want an svg image to be embedded in an pdf document that I render by using rmarkdown. This doesn't seem possible, or do I miss something? If it's not possible is there a way to first convert the .svg image to a .png before embedding it? In my rmarkdown file it looks like this (notice the two different kinds of inserting the image): ```{r results="asis",eval=TRUE,echo=FALSE,message=FALSE, error=FALSE, warning=FALSE, comment = NA,fig.height=10} cat("![](svg_file.svg)") ``` ![](svg_file.svg)

First-line paragraph indenting in PDFs using R Markdown

我只是一个虾纸丫 提交于 2019-12-04 21:45:25
问题 I'm hoping this is a question with a simple answer. I am using Rmarkdown/knitr to author a PDF document (in RStudio). Many LaTeX classes (like article) automatically indent the first line of a paragraph of text, but Rmarkdown does not, nor can I figure out a way to do so. Here's a simple example: --- title: "minimal" author: "prison rodeo" output: pdf_document --- This is an R Markdown document. I would like this paragraph to be first-line indented, but it is not. Using > indents the entire

RMarkdown / pandoc fails to knit Pdf with latex color commands

删除回忆录丶 提交于 2019-12-04 20:40:44
Mac Os: 10.11.6 R version: 3.3.1 MacTex: 2016 / TexLive: 6.2.2 RMarkdown: 1.0.9014 Knitr: 1.14 Pandoc: 1.17 RMarkdown fails to knit PDF when latex commands such as: \textcolor{blue}{Character String} are present in the .rmd file. The error output is: /usr/local/bin/pandoc +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template ~/R/3.3/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine /Library/TeX/texbin/pdflatex --variable graphics=yes --variable 'geometry:margin

Tables and Figures side-by-side in Knitr or RMarkdown Beamer

不问归期 提交于 2019-12-04 20:05:18
问题 I am trying to create a Beamer Presentation slide in RMarkdown / Knitr . In the slide I would like to have a table and a figure placed Side-by-side , and then some more text underneath. I can only get as far as my attempt as shown in the code. I would like to have the density plot placed, next to the Hmisc Table. I am not using Kable or xtable since I get more control over the tables with Hmisc. Also, How can I adjust the text characteristics (font-size, type, color) in the individual slides?

How do I get a long (more than 1 page) bibliography to print in an R markdown beamer?

独自空忆成欢 提交于 2019-12-04 19:57:04
I have an issue rendering bibliographies covering more than one page as only the first one is printed using RMarkdown and beamer output. The same question has been posted at http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html#comment-2398115545 but without any help. --- title: "Sample Document" output: beamer_presentation bibliography: bibliography.bib --- scoa You can force a slide to be continued on the next one by setting its class to allowframebreaks . Just do this for your last slide. From the pandoc mailing-list : ## References {.allowframebreaks} Edit: knitr has a

DT package not working with blogdown using hugo-future-imperfect theme

前提是你 提交于 2019-12-04 19:55:38
问题 I have a blogdown site based on the hugo-future-imperfect theme where a DT output is created correctly in the rmd but the data is not shown (although the headings are) when applying serve_site/build_site I have created two brand new sites ( so with no other complications) to illustrate the issue. This is the code and outputs ```{r DT} library(DT) library(tidyverse) iris %>% datatable() ``` a) default theme b) hugo-imperfect 回答1: From https://owi.usgs.gov/blog/leaflet/ and https://github.com

R Markdown Shiny renderPlot list of plots from lapply

雨燕双飞 提交于 2019-12-04 19:41:26
I am developing an R Markdown Shiny document to: Subset a data frame to include the "date" column and some numeric data columns. The way the shiny user input is set up, you select radio buttons for the data columns to include, then hit the "Subset Data" button to create d() - NO PROBLEM:) Generate a list of plots ( plotList ), one for each numeric data column (plotted against the date column). I am using the openair package timePlot function to generate the plots, and lapply to generate the list of plot objects ( plotList ) - NO PROBLEM:) use renderPlot to output all the plots in plotList to

Disable mouse click to show another slide in rmarkdown slidy_presentation

女生的网名这么多〃 提交于 2019-12-04 19:36:09
I'm wondering how to disable left mouse click to show another slide in rmarkdown slidy_presentation. If I'm trying to disable/enable some category in plotly chart, it'll skip to another slide. Is there any option how to handle it. Many thanks for your suggestions in forward. rasnes In my current version of slidy (rmarkdown 1.6) you can disable/enable mouse click advance by pressing key 'k' , when viewing the presentation. To change the default (on file open) behavior I had to change line 55 in [R package library]/rmarkdown/rmd/slidy/Slidy2/scripts/slidy.js to mouse_click_enabled: false, //