knitr

knitcitations gives pandoc-citeproc error

邮差的信 提交于 2020-01-12 08:01:09
问题 I have the following document, that I am trying to compile with Rstudio: --- output: word_document: pandoc_args: [ "--biblio", "references.bib" ] --- ```{r} library("knitcitations") cleanbib() ``` This is a citation citet("10.1098/rspb.2013.1372"): ```{r} citet("10.1098/rspb.2013.1372") ``` ```{r} write.bibtex(file="references.bib") ``` ```{r} summary(cars) ``` When I run knit, it compiles the .md file, but pandoc gives an error: processing file: toy.Rmd |...................... | 33% ordinary

purl() within knit() duplicate label error

可紊 提交于 2020-01-12 05:10:27
问题 I am knitting a .Rmd file and want to have two outputs: the html and a purl'ed R script each time I run knit. This can be done with the following Rmd file: --- title: "Purl MWE" output: html_document --- ```{r} ## This chunk automatically generates a text .R version of this script when running within knitr. input = knitr::current_input() # filename of input document output = paste(tools::file_path_sans_ext(input), 'R', sep = '.') knitr::purl(input,output,documentation=1,quiet=T) ``` ```{r} x

html of rmarkdown file (.Rmd) is not displayed correctly in browser

余生长醉 提交于 2020-01-11 14:36:08
问题 When I knit my .Rmd to html, it does not get displayed properly, i. e. it seems like something is wrong with the format (see screenshot below): The two hyperlinks do not work, the font is not sans-serif, there is no table of contents, etc. I used the same code on a different machine 6 months ago and it rendered as expected. However, today it does not. Does anybody have an idea why the html looks ugly? It seems not to depend on the browser I open the html with (tested it in IE and Chrome).

Colorize/highlight values of R ftable() output in knitr/Sweave rapports

試著忘記壹切 提交于 2020-01-11 02:57:11
问题 I am generating a lot of ftable() crosstabulations for a descriptive report. Example: AUS BEL BUL EST FRA GEO GER HUN ITA NET NOR ROM RUS 30- primary 0.06 0.03 0.07 0.03 0.02 0.03 0.03 0.02 0.05 0.03 0.05 0.04 0.02 secondary 0.30 0.09 0.16 0.10 0.10 0.14 0.10 0.16 0.11 0.08 0.08 0.09 0.11 tertiary 0.05 0.07 0.04 0.05 0.07 0.06 0.02 0.04 0.02 0.05 0.06 0.02 0.09 30+ primary 0.07 0.16 0.12 0.07 0.16 0.03 0.05 0.11 0.35 0.21 0.09 0.17 0.03 secondary 0.40 0.20 0.30 0.29 0.25 0.35 0.35 0.34 0.27 0

Embedding plotly output in R markdown

被刻印的时光 ゝ 提交于 2020-01-10 20:04:46
问题 There is a blog entry which describes embedding from the plotly API for R into R markdown. I just used the code to create the iframe for an html document When I have the prieview in R studio there is no error message and the iframe is created in the html document. However, it is just empty. Apparently it does not load the content somehow. I did not create the plot in the R API beforehand (but that should not matter as this is just embedding a picture into html) isn't it? My code in r markdown

Embedding plotly output in R markdown

£可爱£侵袭症+ 提交于 2020-01-10 20:03:52
问题 There is a blog entry which describes embedding from the plotly API for R into R markdown. I just used the code to create the iframe for an html document When I have the prieview in R studio there is no error message and the iframe is created in the html document. However, it is just empty. Apparently it does not load the content somehow. I did not create the plot in the R API beforehand (but that should not matter as this is just embedding a picture into html) isn't it? My code in r markdown

knitr .Rmd vignettes do not appear with vignette()

为君一笑 提交于 2020-01-10 12:38:39
问题 In a package I'm developing with R Studio, I create vignettes via devtools::use_vignette("mydoc.Rnw") , which gives a standard vignette header like --- title: "Title" author: "Michael Friendly" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Title} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- I have followed all the instructions in http://yihui.name/knitr/demo/vignette/ and http://r-pkgs.had.co.nz/vignettes.html. The vignettes are

knitr .Rmd vignettes do not appear with vignette()

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-10 12:38:15
问题 In a package I'm developing with R Studio, I create vignettes via devtools::use_vignette("mydoc.Rnw") , which gives a standard vignette header like --- title: "Title" author: "Michael Friendly" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Title} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- I have followed all the instructions in http://yihui.name/knitr/demo/vignette/ and http://r-pkgs.had.co.nz/vignettes.html. The vignettes are

knitr: How to prevent text wrapping in output?

浪子不回头ぞ 提交于 2020-01-09 02:13:11
问题 I am having a problem with text wrapping in code output chunks in knitr when knitting to HTML. For example, if I run the following: matrix(rnorm(60, 5, 2), ncol = 12) The output in HTML will wrap the table, giving an output like this, where the 12th column is moved underneath the rest: ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] ## [1,] 3.407 0.8035 2.981 5.269 6.989 5.107 7.143 3.127 3.624 7.220 4.805 ## [2,] 3.907 5.5971 5.488 4.995 6.496 5.980 1.576 3.009 6.605 3.440 2.754

how do you publish rCharts with knitHTML

左心房为你撑大大i 提交于 2020-01-07 03:56:07
问题 I am trying to publish rCharts in knitrHTML, I keep getting this error: Quitting from lines 11-43 (ddd.Rmd) Error in file(con, "w") : cannot open the connection Calls: <Anonymous> ... <Anonymous> -> <Anonymous> -> <Anonymous> -> writeLines -> file Execution halted this is my kode within the markdown: rPlot(cpubusy ~ datetime, color = 'machine', type = 'point', data = server) How could I resolve this? what am I missing? 回答1: See - Ramnath answer. Basically to add rCharts and have it rendered