Issue I’m trying to generate an HTML report using RStudio, R Markdown and knitr. In the report I would like to display some bash code. I do not want to run the code but I would like it to be
Continue readingTag: knitr
syntax highlighting while rendering SQL using knitr
Issue knitr will execute SQL code using engine=’mysql’ but not highlight syntax: \documentclass{article} \begin{document} <<engine=’mysql’, engine.opts=”-h localhost”>>= SHOW DATABASES; @ \end{document} On the other hand using engine=’highlight’ will highlight the code but not execute it. \documentclass{article} \begin{document} <<engine=’highlight’, engine.opts=’-S sql
Continue readingknitr syntax highlighting in .Rnw files (LaTeX)
Issue I am using .Rnw files to produce a report with LaTeX and knitr. My knitr_setup looks as follows: <<knitr_setup, echo=FALSE>>= library(knitr) opts_chunk$set(highlight = TRUE, cache = TRUE, eval = FALSE, size = “small”) options(width = 60) opts_knit$set(out.format = “latex”)
Continue readingApply different scopes to the same character in a Sublime Text syntax definition file
Issue I’m trying to create a new .tmLanguage file for Sublime Text 2 that defines special fenced code blocks for knitr and Markdown. These blocks take this form: “`{r example_chunk, echo=true} x <- rnorm(100) y <- rnorm(100) plot(y ~ x,
Continue readingHow to use variable R code in a Knitr chunk?
Issue I want to demonstrate use of a piece of R code. But I want the code to be variable itself. Example two tasks: Randomly select two variables from a data frame and add those columns. Randomly select a set
Continue readingHow to syntax highlight inline R code in R Markdown?
Issue This question is similar to consistent code html inline and in chunks with knitr. Instead of .Rhtml documents, I want to highlight inline R code in R Markdown documents, e.g., after `r “plot(cars, main = ‘A scatterplot.’)”` is compiled
Continue readingStata syntax highlighting in Rmarkdown
Issue I am using Bookdown and Rmarkdown to compose a technical book for Stata users. I would like to include Stata highlighting syntax in the chunks of code, but I am not interested in actually executing Stata from Rstudio. I
Continue readingincluding a interactive 3D figure with knitr
Issue Using knitr it is possible to embed a rgl 3D graphics in a html document from a Rmarkdown source file: “`{r setup} library(rgl) knit_hooks$set(rgl = hook_rgl) x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x,y) “` “`{r,
Continue readingHow to remove border box around R Markdown HTML output using Knitr chunk options
Issue When knitting R code chunks to HTML in R Markdown, it’s possible to alter certain visual elements by setting chunk options (figure height, displaying messages/warnings, etc.). I’m curious about whether there’s a chunk option to remove the gray border
Continue readingPubishing to rpubs existing html file
Issue I am trying to publish to rpubs a html file generated from a rmd using knithtml. However, the knitting takes too long to run and i would not want to rerun the whole knit process again just to make
Continue reading