Questions tagged [rnw]

.Rnw is a file extension used for documents with markup and and/r chunks.

determines the appropriate set of patterns (regular expressions) to use to extract code and chunk options based on the file extension (if the patterns are not provided in advance). See ?knit_patterns for more information.

84 questions
0
votes
0 answers

Put figure directly into Knitr document (without saving file of it in folder) Part 2

I am extending a question I recently posted here (Put figure directly into Knitr document (without saving file of it in folder)). I am writing an R package that generates a .pdf file for users that outputs summarizations of data. I have a .Rnw…
user4148072
0
votes
1 answer

knitr: fig.height must be numeric in new version?

I downloaded a new version of the knitr package and suddenly I get the following error when trying to include a plot in an Rnw file: Error in options[[sprintf("fig.%s", i)]] * options$dpi : non-numeric argument to binary operator Calls: knit ...…
Vincent
  • 677
  • 2
  • 7
  • 19
0
votes
1 answer

Modify external R script in a knitr chunk

I'm wondering if it's possible to hook into the code in an external R script that is read by knitr. Specifically, say that you have the following R file test.R ## ---- CarPlot library(ggplot2) CarPlot <- ggplot() + stat_summary(data = mtcars, …
Adam Liter
  • 875
  • 2
  • 10
  • 30
0
votes
1 answer

Link between sections in .Rnw file in RStudio

I am trying to create a link in a subsection of the main report to redirect to a subsection of the Appendix in an .Rnw file in Studio. Here is what I have tried. Although I do not get an error, and it produces a PDF file, there does not seem to be…
user1830307
0
votes
1 answer

Using ggparcoord in .Rnw file in RStudio

I am trying to create a PDF file (from Sweave .Rnw file in Rstudio). When I run the code on its own, it seems to work: library(ggplot2) library(GGally) ggparcoord(data.frame(mtcars), columns=1:6, alphaLines=0, boxplot=TRUE, scale="globalminmax") +…
user1830307
0
votes
1 answer

Read chunk from Rmd file to Rnw file

I want to read chunks in an RMD file from an RNW file, both of which are in different folders. I cannot make it work. It seems like it is not possible to read chunks from an RMD file. read_chunk() function seems to read only from an .R file. But in…
HBat
  • 4,873
  • 4
  • 39
  • 56
0
votes
1 answer

Multiple inputs into a R function

So I currently have this code below in a file, pullsec.R pullsec <- function(session=NULL){ if(is.null(session)) session<-1 stopifnot(is.numeric(session)) paste("Session",1:10)[session] } In an .Rnw file, I call on this pullsec.R and choose…
user12279
  • 21
  • 1
  • 4
-1
votes
1 answer

R - knitr | .Rnw | How to comment, to avoid compilation errors?

Edit: I am using RStudio Up till now, while commenting something, I was using % symbol. Alternatively, I am just using Ctrl+Shift+C shortcut, which results in commenting with % or %' (or # for chunks). The problem is, even if I comment something, it…
Kusavil
  • 294
  • 6
  • 15
-1
votes
1 answer

Compile Knitr .Rnw from R file, problems with do.call()

I'm compiling knitr document from a .R file: knit2pdf(example.Rnw, output=paste0(name,".tex")) But in the document example.Rnw, there's the function: do.call(cbind,mget(as.character(rep_names))) Where rep_names it's the name of some dataframes…
1 2 3 4 5
6