r-markdown

knit HTML does not save html in vignettes/

浪子不回头ぞ 提交于 2019-12-21 04:11:36
问题 So I have a vignette, vignettes/test-vignette3.Rmd : --- title: "Sample Document" output: html_document: highlight: kate theme: spacelab toc: yes pdf_document: toc: yes --- Header ========= When I hit the knit HTML button, I get the following: processing file: test-vignette3.Rmd output file: test-vignette3.knit.md Output created: /tmp/RtmpKVpegL/preview-5ef42271c0d5.dir/test-vignette3.html However, if I copy this file to inst/doc and hit the knit HTML button, I get: processing file: test

How to build a pdf vignette in R and RStudio

孤者浪人 提交于 2019-12-21 04:04:51
问题 I am new to writing R packages. I'm trying to learn how to make a vignette for my package. I have created a vignettes folder with a file "getting-started.Rmd" --- title: "WaterML Tutorial" author: "Jiri Kadlec" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Introduction to the WaterML R package} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ## Quick Start This simple example shows how to get started with the <my R package>. To build

python highlighting in Rmarkdown in RStudio

﹥>﹥吖頭↗ 提交于 2019-12-21 02:01:06
问题 I'm using RStudio 0.98.1103. It is said in release notes that they've added "Syntax highlighting modes for XML, YAML, SQL, Python, and shell scripts." But when I write something like this: ```{r engine='python', highlight=TRUE} print("Hello World") ``` - I don't get proper highlighting (like I have here). I've seen this question: Syntax highlighting for Python chunks does not work - but I guess it was asked before the release of 0.98.1103 and things could've change, I'm just doing something

Inserting a page break within a code chunk in rmarkdown (converting to pdf)

大憨熊 提交于 2019-12-20 17:36:56
问题 I am using rmarkdown, pandoc and knitr to create a pdf including chunks of r code. Within a code chunk I have a for loop which prints a number of graphs and some statistical output. I would like to insert a page break into the loop (to appear in the pdf output). This page break would occur after each graph is printed, to ensure each graph is printed on one page and the statistical output on the next. I have been unable to find a way of including a page break in my r code chunk. I have tried

output markdown in r code chunk

帅比萌擦擦* 提交于 2019-12-20 14:20:17
问题 I have a R markdown file that I want to output rmarkdown from the script itself. For example, I would have the following simple code in an Rmd file. --- title: "test" author: "johndoe" date: "September 5, 2015" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r cars} paste("## This is a Heading in Code") summary(cars) ``` I want "This is a Heading in Code" to render in rmarkdown. There is a solution in an R script to generate markdown as per

Warning messages keep appearing in RStudio notebooks in chunks unrelated to the warnings

假装没事ソ 提交于 2019-12-20 11:13:22
问题 I am starting to use RStudio notebooks, and I am still trying to understand how some of the things work. I do not understand why some produced warning messages are kept and appear when executing code that is completely unrelated to the message. For instance, I have a document with several chunks, where the last of them produces the warning > warnings() Warning messages: 1: Unknown or uninitialised column: 'perc.goal.met.period'. 2: Unknown or uninitialised column: 'perc.goal.met.period'. 3:

Reduce space between code chunks and code output in rmarkdown beamer presentation

假如想象 提交于 2019-12-20 09:16:55
问题 I'm building a presentation using rmarkdown and LaTeX/Beamer. I would like to reduce the spacing between the displayed R-commands and R-output. I believe this is related to the paragraph spacing options in LaTeX/Beamer. Is this something I should do in rmarkdown (chunk options, knit_hooks, or something else?), in the pandoc Yaml header (some pandoc option?), or in the LaTeX beamer template file? I feel like it should be in the LaTeX template file. Below is a working example of a minimal

Generating view of cache object in Markdown document in R

被刻印的时光 ゝ 提交于 2019-12-20 06:24:32
问题 I cannot show object in markdown document that are objects generated in different R script(within the same session). I would like to point out that I am newbie to markdown. So the code is as follows(''' are added before and after): {r eval=TRUE, echo=FALSE} head(output_by_size,10) # 1st line summary(cars) # 2nd line dim(iris) # 3rd line when I comment line 2nd and 3rd the following error is generated: Error in head(output_by_size, 10) : object 'output_by_size' not found Calls: ...

R Notebook HTML Format - add hyperlinks to paged table

流过昼夜 提交于 2019-12-20 04:22:38
问题 I wish to knit an html file from an R Notebook that contains paged tables with hyperlinks. Hyperlinks can be inserted using knitr::kable , but I can't find a way to generate a paged table with this function. Paged tables are the default notebook output, but I can't find a way of inserting functional hyperlinks . Many thanks for your help. --- title: "Paged notebook table with hyperlinks" output: html_notebook: code_folding: "hide" --- ```{r rows.print=3} wiki.url <- "https://en.wikipedia.org

Plot neural net work

为君一笑 提交于 2019-12-20 03:26:15
问题 I use RStudio. In order to plot neural network, I use the package neuralnet and function 'plot' to do the picture. But I find that every time, it will just show me a separated picture by Quartz rather than as in the plot field of RStudio. Furthermore, plot does not work under RMarkdown. Can anyone tell how to fix it? It seems I need to disable the Quartz from RStudio. Thanks The following is the code set.seed(500) library(MASS) data <- Boston apply(data,2,function(x) sum(is.na(x))) index <-