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
3
votes
1 answer

xtable for conditional cell formatting not with special characters

I'm apply solution from xtable for conditional cell formatting significant p-values of table to my data set; however, I can't use sanitize.text.function = function(x) x as per the suggested answer. Example Data set The data set contains text…
Konrad
  • 17,740
  • 16
  • 106
  • 167
3
votes
1 answer

Include rgl interactive plot in .Rnw (pdf output)

Description of Problem I'd like to include an interactive (rotating) rgl 3-d scatterplot in a .pdf knitted from a .Rnw file. I know there is a hook for including rgl but maybe this is for html output only. I can't seem to include the plot so that…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
3
votes
0 answers

including preamble to knitr as individual file (.Rnw)

I want to have separated file with preamble and include it to the main document. So I created file. preamble.Rnw: \documentclass[12 pt,…
jjankowiak
  • 3,010
  • 6
  • 28
  • 45
2
votes
0 answers

knitr xtable with long head note too long, stretch out the entire table

I'm new to knitr and Latex stuff, so this may be a very naive question, but I failed to find a correct answer. I'm doing empirical research that sometimes, we need to add headnotes as instruction for a complex table. Below is the code I'm currently…
Jia Gao
  • 1,172
  • 3
  • 13
  • 26
2
votes
1 answer

Pandoc version 2.7.3 fails to convert knitr .tex file to .docx

I've been using knitr in combination with .Rnw files in Rstudio to generate both pdf and docx files without any issue until today. The pdf conversion runs natively with Rstudio and for the docx conversion I simply call pandoc under the hood by…
oseg
  • 31
  • 3
2
votes
2 answers

Reuse r code with knitr in rnw / sweave files

I'm searching for a way to reuse r-code in latex using knitr. I have multiple excel documents, that I want to import, analyze and plot in the same way throughout my thesis. Right now I am making a new .rnw file for each excel document that I have.…
2
votes
1 answer

run selected code chunks in knitr by filtering names of code chunk

I am implementing an algorithm which has a lot of formulas in knitr. So I define some functions in some code chunks with names in the pattern <>=@, and define unit test in other code chunks with names in the pattern <>=@. Now, I…
sunxd
  • 743
  • 1
  • 9
  • 24
2
votes
1 answer

How to use %in% in Sexpr in R/Sweave?

Here is my code in a Rnw file : \Sexpr{length(which(x %in% c('a', 'b')))} As % is the syntax for comments, this code doesn't work. How to use %in% in Sexpr in R/Sweave ?
Marion H.
  • 61
  • 6
2
votes
1 answer

With knitr, preserve chunk options when purling chunks into separate files

For teaching purposes, I would like to purl the chunks of my .Rnw file into separate files. This answer explains how to do it: How to purl each chunks in .Rmd file to multiple .R files using Knitr BUT the method does not preserve the chunk options.…
jtr13
  • 1,225
  • 11
  • 25
2
votes
3 answers

Insert multiple images in for-loop into Sweave Document

I have five images stored as follows (where "currentDirectory" is the result I get from the command…
user1830307
2
votes
1 answer

Only run knitr on parts of Rnw file that have changed

Say I have two code blocks contained within an Rnw file, code_block_1 and code_block_2. Lets say I make to changes to code_block_1 but code_block_2 remains unchanged. I'm using knitr to convert the Rnw file to a tex file. Because code_block_2 has…
luciano
  • 13,158
  • 36
  • 90
  • 130
2
votes
1 answer

rnw linebreak, tidy won't work

I am new to R noweb. Actually, it is my first Rnw file (about 200 lines now, and Rnw is awesome!). My Problem: I have a couple of very long chunk lines, that exceed the paper. I have spent quite a long time on that now, and have of course stumbled…
Serijoscha
  • 53
  • 6
2
votes
1 answer

How to send code to SublimeREPL in Sublime Text 3?

I am using LaTeXing, SublimeREPL, and R-Box to work with .Rnw files so I can have LaTeX with R code chunks. However, when I try to go to "Tools->SublimeREPL->Eval in REPL->Line" I get the following error. Cannot find REPL for…
user2205916
  • 3,196
  • 11
  • 54
  • 82
2
votes
1 answer

Using xtable function on candisc::cancor output

I want to use xtable function on candisc::cancor output. But could not figure it out. library(xtable) library(candisc) data(Rohwer, package="heplots") X <- as.matrix(Rohwer[,6:10]) # the PA tests Y <- as.matrix(Rohwer[,3:5]) # the…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
2
votes
0 answers

Text bleeding out of page in knitr using latex

I am using the following code snippet to write some text data frame as a table. temp<-c("A white paper is a document that describes a given problem and proposes a specific solution to the problem.", "Originally used to describe government policy,…
Next Door Engineer
  • 2,818
  • 4
  • 20
  • 33