Questions tagged [knitr-spin]

`knitr::spin` is a tool for formatting specially marked R script into a beautiful document that contains comments, plots, tables and code. Use together with the generic `knitr` tag to guide search for spinr related questions.

knitr::spin is a part of the knitr package by Yihui Xie intended for dynamic generation of documents complete with computation results and code directly out of R scripts.

Useful links

26 questions
1
vote
0 answers

Inline command to knit a chunk

The knitr::read_chunk function is great for referencing chunks in documents. For example, given an annotated R script: # test.R ## ---- scatter ---------- x <- rnorm(100) y <- rnorm(100) plot(y ~ x, pch = 19) ## ---- hists ---------- par(mfrow =…
Alexey Shiklomanov
  • 1,592
  • 13
  • 23
1
vote
1 answer

Is it possible to call knitr::spin on two different R scripts and produce a single html file?

I have two different R scripts. I love the idea of knitr::spin. I wanted to know if there's a way to call spin on these two scripts which are both formatted with roxygen2 and produce a single report.
0
votes
1 answer

Conditionally display sections on .html using knitr::spin() on .R script

I'm rendering an .html file using knitr::spin() on a .R script file, and I want to conditionally display sections in its .html output file. I have some example code below of what I have so…
theneil
  • 488
  • 1
  • 4
  • 14
0
votes
0 answers

How can I fix the formatting issue with the separating line in modelsummary output tables?

When I summarize my regression outputs in a modelsummary table, I get an unpleasant formatting problem. I used the following code: modelsummary(ols, statistic = "p.value") and get the following output when I knit it to PDF. Output after knitting to…
Felix
  • 1
  • 1
0
votes
0 answers

Cannot find the specified file

Can someone tell me why R wont knit my R Markdown archive? It says the data set "dailyActivity_merged" does not exist in the current working directory, but I have already added this to the files and it is loaded I want to knit an rmd file from R, I…
0
votes
1 answer

Chunk option eval=FALSE ignored when spinning R-script

Spinning the following code (by clicking compile report in Rstudio): #+ eval = FALSE This line should not be syntax-checked, but it is. Returns this error: Error in parse(text = x, keep.source = TRUE) : :2:6: unexpected symbol 1: #+ eval =…
Rasmus Larsen
  • 5,721
  • 8
  • 47
  • 79
0
votes
0 answers

Is there a way to knit multiple HTML documents by chunk within one Rscript?

Is there a way to knit only certain chunks into a HTML document? Say I'm doing analysis on 3 different cell markers, can I tell R to start knitting at the beginning of Marker1 and stop knitting at the end of Marker 1, then start knitting at Marker 2…
iastatecy
  • 67
  • 7
0
votes
1 answer

Using R, RStudio Knit to PDF, how to pass custom flags to the "pdflatex" command such as -interaction=nonstopmode

I am coming to RStudio from the CMD prompt and the pdflatex command. From my understanding, RStudio runs behind the scenes: pdflatex bibtex (if you have natbib going on) pdflatex I would like to be able to pass some parameters like "-quiet" or…
mshaffer
  • 959
  • 1
  • 9
  • 19
0
votes
2 answers

RMarkdown render to Notebook with child chunks included

I'm after a way to render an Rmd document (that contains references to various "child" files) to a self-contained R Notebook without these dependencies. At the moment, the .Rmd code chunks are located throughout a number of .R, .py and .sql files…
ruaridhw
  • 2,305
  • 8
  • 22
0
votes
1 answer

Use of @ in R programming, or R markdown?

I've downloaded code from another programmer, and they have the following: #' @param gr a GRanges of regions/DMRs/whatever #' @param HMM a GRanges with ChromHMM annotations (name, itemRgb) #' @param background a…
Gaius Augustus
  • 940
  • 2
  • 15
  • 37
0
votes
0 answers

Text instead of image in pdf generated from rmarkdown

When I run my r-markdown code to generate a PDF, there is text in the place of images. The chunks are run and pdf images generated in the "figure" folder but where the images should be in the PDF is text figure/unnamed-chunk-12.pdf. I've never had…
ThatGuy
  • 1,225
  • 10
  • 28
1
2