Questions tagged [sweave]

Sweave is a system for combining S (or R) code with LaTeX in a single document.

sweave
Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Sweave option to hold output and flush it at the end of the chunk

Knitr / Quarto have an option (results: hold) to "hold all pieces of text output in a chunk and flush them to the end of the chunk." Does Sweave have a similar option? I searched the ...
Alex Strashny's user avatar
0 votes
0 answers
21 views

Sweave Error "found no \\citation commands"

I am using Sweave to build a pdf and things were running fine. I recently reinstalled Miktex and Texnic Centre. Even when building a basic document such as the RNW below, I am getting the error "...
osckt's user avatar
  • 15
0 votes
0 answers
39 views

Highlight LateX Code Math Environment within R Studio using Sweave and .RNW File

When creating a pdf involving LateX and R code in Rstudio, is it possible to have LaTeX code highlighted whenever a math environment is created? I am frequently having errors from unmatched $ symbols ...
Michael's user avatar
  • 1,567
0 votes
0 answers
757 views

LaTeX Error: Invalid UTF-8 byte sequence in R Sweave

I'm new using Sweave in R. All guides I've seen begin trying to compile to PDF the simplest document (code below): \documentclass[10pt, a4paper]{article} \title{My title} \author{Some text with ...
user123456's user avatar
0 votes
1 answer
38 views

How do I tile plots from a ggplot on a page using r/sweave/latex

I am using R/Sweave/Latex to create an article with ggplot plots in it. I would like to tile 4 plots on one page and I'm wondering what the best way is to go about it? code for one of my plots is ...
osckt's user avatar
  • 15
1 vote
0 answers
66 views

Print big r matrix in Latex with Sweave, knitr or Rmd

Printing big r matrix in Latex. I came out with this function which loops over rows.. is there any smarter way to do it? Is there a way to create a loop in Latex syntax? \documentclass{article} \...
rEbbasta's user avatar
0 votes
1 answer
78 views

How to insert three or more r plots side by side on one row in a knit to pdf document?

I am using Rstudio to produce a figure with r plot as subfigures. I know how to knit to pdf (.rnw) to insert 6 figures on the same page by putting two r plots side by side on the same line using the ...
CharlesLDN's user avatar
0 votes
0 answers
21 views

cannot get .rnw and .rmd files to work emacs/ess [duplicate]

Trying to use sweave and rmarkdown in emacs. I keep getting File mode specification error: (wrong-type-argument stringp \.) when trying to create either an .rmd file or .rnw file. Here is my .emacs ...
neuroandstats's user avatar
0 votes
0 answers
90 views

How can I compile .Rnw files to .pdf from the Index file of a Bookdwon project?

Previously, I have generated multiple reports in .Rnw format to .pdf in R via the knit2pdf() command. However, today I am facing the following problem, I will detail it by steps: I am building a ...
Daniel F's user avatar
0 votes
0 answers
17 views

Is there a function that will list packages required for knitting an Rmd or Rnw file? [duplicate]

RStudio detects if package(s) required for knitting an Rnw or Rmd file are not installed. It therefore has a mechanism that it can use to check what packages are required. Is there a function, ...
John Maindonald's user avatar
0 votes
0 answers
155 views

How to fix `plex-otf.sty` not found

I am trying to compile an Rsweave document. I recently migrated from a Macbook to a Thinkpad running rhel. Previously on my macbook after simply downloading and in stalling the fonts, a document wih ...
Liam385's user avatar
  • 111
0 votes
0 answers
106 views

MikTex lstlisting package with quotes

I'm using the beamer class to create slides and using the lstlisting package inside a colorbox. Below is a reproducible example showing my problem when using pdflatex. I'm trying to use quotes (")...
dhc's user avatar
  • 757
0 votes
1 answer
335 views

Errors compiling Rnw beamer presentation

I have a collection of old lectures, written as .Rnw files using LaTeX beamer for presentations. They no longer compile, and I am mystified why. Here is a minimal example, test-beamer.Rnw just trying ...
user101089's user avatar
  • 3,840
0 votes
1 answer
34 views

knitr with octave out.width does not restrict text out runs out of margin

The following is the minimal reproducing example, if you use debian system, one can install octave by snap or apt easily. \documentclass[english]{article} \title{Minimal example of octave with knitr ...
sunxd's user avatar
  • 751
0 votes
0 answers
3k views

"Error: LaTeX failed to compile" output when using TinyTex; error running pdflatex (exit code 1)

I'm using an R Sweave doc and trying to compile a pdf from RStudio using TinyTex. Let's assume my Sweave file is titled "Example.Rnw" and my file path to the .tex output is "Path/...
Steve K's user avatar
  • 41
0 votes
0 answers
322 views

Is there any way to restore an older version of a .Rnw file that's been overwritten?

Shot in the dark here, but by accident I recently saved over an important .Rnw file in RStudio that contained months' worth of work. The new version I saved is missing pretty much everything. It would ...
Steve K's user avatar
  • 41
0 votes
0 answers
86 views

R Shiny:The correct output is not printed in R Sweave Report

as my last 2 questions: This and this, and after the last advice, I tried to make an MRE to summarize the problem- after some runs, even if in R Shiny App the output is printed correct, in R Sweave ...
Maria Ruxandra's user avatar
0 votes
0 answers
451 views

Sweave Missing endcsname Error in Huxtable While Generating PDF

I am running into an issue in the process of generating PDFs through R/Sweave/tinytex on a CentOS server. Here is the command that runs the process: (generateReport.R) Sweave(rnwFile, encoding = "...
Danchat's user avatar
  • 136
1 vote
1 answer
126 views

Cloze questions without solution environment does not work in R/exams

I tried one of the R/exams examples posted in the forum and tried to create Moodle questions but I get following error message. exams2moodle("sample_1.Rnw") ## Error in split.default(...
Fazeel Jaleel's user avatar
0 votes
0 answers
97 views

R Shiny-The correct output is not printed in R Sweave Report

Some weeks ago I asked:this question, which unfortunately did not received any answer. After recommendation, I tried to make a MRE and I hope that in this way everything will be much clear. The ...
Maria Ruxandra's user avatar
0 votes
0 answers
110 views

R Sweave doesn't generate the correct output from R Shiny

I have made a R Shiny App where after some statistical tests, a pdf-report is generated with knit2pdf and R Sweave. The problem is that the R Sweave doesn't print the correct values of tests, after ...
Maria Ruxandra's user avatar
4 votes
0 answers
140 views

How to wrap text output of user defined function in R Sweave to pdf

When compiling to pdf through Sweave, we are unable to have the output of user defined functions wrap text, instead they run off the page and are not readable. Example code of output similar to one of ...
Laura Jamison's user avatar
0 votes
2 answers
116 views

qrcode_gen in R

I am the function qrcode_gen in R to generate a qrcode. My objective is to generate a latex file using sweave, with a QRCode. But I cannot resize it. qrcode_gen("YourString", softLimitFlag = ...
Eduardo Pécora's user avatar
0 votes
1 answer
280 views

Sweave - using a variable from Latex into code chunks

I need to use variable (ie. an argument of a custom command) from latex into a R inline code chunk. See, for instance : \newcommand{\textvar}[1]{ \textbf{ \Sexpr{ # Here, I would like to ...
Léo Joubert's user avatar
6 votes
3 answers
4k views

RStudio Sweave error -> exit code -1073740791

I have problem with running my .rnw (I am running Sweave) files in RStudio due to this error message: Writing to file test.tex Processing code chunks with options ... You can now run (pdf)latex on '...
Gregor G.'s user avatar
2 votes
0 answers
477 views

Sweave .rnw files won't produce a pdf in RStudio

everyone, Everytime I try to compile a PDF on Rstudio using Sweave, I get this error: Running pdflatex.exe on PS1.tex...failed Error running C:/PROGRA~1/MikText/miktex/bin/x64/pdflatex.exe (exit code ...
Rnub's user avatar
  • 29
0 votes
1 answer
143 views

why suppress Error in Rmarkdown doesn't work?

I want to supress Errors in Rmw files. So, i've tried to set the global chunk option error=TRUE, but it doesn't work. Also it doesn't work to set the chunk option error=TRUE directly in the chunk. ...
james_rodriguez's user avatar
1 vote
2 answers
178 views

Problems with exams2pdf after updating R version

Recently, I have updated R using installr so that I have now two versions (3.6.1 e 4.0.3) installed in my computer running Windows 10, but I only use the 4.0.3 version. For some reasons I do not know, ...
user12703198's user avatar
3 votes
2 answers
5k views

Can't compile pdf using R sweave. Latex error: file 'ae.sty' not found

I can't compile a pdf using R sweave. I keep getting the following error Latex error: file 'ae.sty' not found \documentclass{article} \begin{document} \SweaveOpts{concordance=TRUE} Hello, world. \...
vitor taira's user avatar
2 votes
2 answers
108 views

Creation of especialized \Sexpr function version

I'm using the exams package to generate some exams (engineering). My source files are in Rnw format so the underlying engine is Sweave. In R side, I'm using units package (to check dimensionality ...
jamarier's user avatar
1 vote
0 answers
42 views

libstableR library unwanted output

I'm using libstableR library to calculate some estimators and function stable_fit_mle outputs some messages while running, namely tons of Minimizer warning: No error and occasionally also: FINAL ...
Math Guy's user avatar
  • 127
0 votes
1 answer
67 views

How to make the output recognizable in Sweave

I am using Sweave to be able to combine LaTeX and R. I find useful to be able to remove the prefix ">" and "+" from the input writing options(prompt=" ", continue=&...
user12703198's user avatar
1 vote
1 answer
35 views

Why is sweave markup (<<>>=) not working in tabular environment?

I struggle with R and sweave in the tabular environment. I want to have cell markup depending on the content. Thus, I tried an if-condition within the tabular environment, but it does not work out. ...
karl's user avatar
  • 13
4 votes
1 answer
706 views

How do I change the decimal separator in r-exams question to comma?

I'm trying to display a comma as the decimal separator in the questions that I'm creating with the "r-exams/sweave". However, I can't load the siunitx package or do any other configuration ...
Marcos Vinicius's user avatar
1 vote
1 answer
112 views

Size of PDF files generated by knitr

I am using the following chunk in an Rnw file. <<scatter,dev='pdf',include=TRUE>>= a <- rnorm(1e4) b <- rnorm(1e4) plot(a,b) @ I knitted the same Rnw file under R3.6.3 and R4.0.2, ...
Andy's user avatar
  • 11
0 votes
1 answer
269 views

How to specify plot size together with plot code in Sweave or Knitr

I am trying to produce a document using Sweave or Knitr which contains plots. Here is a minimal example for Sweave: \documentclass{article} \title{Plot example} \begin{document} \maketitle <<...
Metamorphic's user avatar
1 vote
0 answers
60 views

R sweave plotting PNG

I am trying to put .png files into a pdf using this code: <<, echo = FALSE, dev = "png", dpi = 300, warning = FALSE, message = FALSE, results = 'asis', fig.cap = "">>= ...
melani's user avatar
  • 43
0 votes
1 answer
396 views

Stop Sweave code chunks in RMarkdown from displaying execution output whilst still displaying the code

I'm writing a publication manuscript for a new R package. The author guidelines expect a self-contained Sweave (Latex+R) project with self-contained executable code within R code chunks in the Sweave ...
Anthony Nash's user avatar
0 votes
1 answer
689 views

Size of plots Knitr

I'm trying to change the size of a wordcloud but I don't know how to do this. Apparently lower values of fig.width make the plot bigger, not smaller, and vice versa. It seems to take up an enormous ...
paulgr's user avatar
  • 89
0 votes
0 answers
43 views

Knitr: storing variables for later use

I'm relatively new to Knitr. I want to run a function just once, so that next time I don't have to evaluate it, because it would yield a different result. My MWE: First time: \documentclass{article} \...
paulgr's user avatar
  • 89
1 vote
0 answers
95 views

\includegraphics{} command was misplaced when compiling R sweave file to pdf through knitr

I was trying to generate two types of figures using a loop in an R Sweave document through knitr package. Figure p1 was saved by png() and dev.off() (this was actually done by a function from a third-...
gyi's user avatar
  • 11
-2 votes
1 answer
614 views

Attempting to Compile a PDF in RStudio with MikTeX fails to generate references, instead resulting in [? ] and no bibliography

I am using Sweave in RStudio to build a pdf with the following settings: Weave Rnw files using: knitr Typeset LaTeX into PDF using: pdfLaTeX I am also on Windows and using MiKTeX. The pdf successfully ...
ZekeMarshall's user avatar
0 votes
1 answer
103 views

I have a for loop of qplots, how can you structure the plots individually using LaTeX code e.g adding captions to the plots

\begin{figure}[h] \centering <<echo=FALSE>>= for(i in 2:38){ print(my_plot_function(i)) } @ \end{figure} This is my code, but what is happening is that when I compile my PDF I only ...
Dylan Dijk's user avatar
1 vote
1 answer
249 views

Is there any alternative to \Sexpr{} to write a matrix object in R?

The function \Sexpr{} does not recognize matrix object. For example, I am setting an exam question using 'exams' package in R. I have two objects generated via R commands 1. opt.obj.val 2. opt.sol. ...
Akram's user avatar
  • 355
2 votes
1 answer
119 views

Source R into chunk

I'm a new in exams so maybe this question is very newbie. I can't source external R-file (contains re-usable functions) into my .Rnw. MWE: functions.r: x <- 10 question.Rnw <<echo=FALSE&...
uzsolt's user avatar
  • 5,917
0 votes
0 answers
432 views

Handling Error in data.frame(..., check.names = FALSE) with knitr and read.csv

I have this toy Rnw example where I want to load some data and use the summary function. I have failed compiling and keeps throwing up the Error in data.frame(..., check.names = FALSE) and I don't ...
Maikol Solís's user avatar
2 votes
2 answers
277 views

How to comment inside a Rnw file with R exams

I would like to know if it is possible to make a comment inside an Rnw file exercise so that something can be completely ignored by both R and LaTeX. This would be useful for me to have some ...
user12703198's user avatar
1 vote
0 answers
225 views

Implementing R code in a LaTeX document with Sweave. Characters like é and è won't display correcty

I always use the bable (french) package and it works fine when one Overleaf or MiKTex. However, when copy pasting my code to Rstudio (with Sweave etc), it just does not work properly. Document with "...
Maga's user avatar
  • 11
-1 votes
1 answer
121 views

how to fix the position of code in Sweave?

I am using sweave to drawing plots and I want to fix the position of R code without fix the position of graphs, that's to say I would like to keep the position of code in the text but have graphs ...
ruiruiyang's user avatar
0 votes
1 answer
1k views

Changing fonts in main title of plot in R

I am using Sweave and knitr together with <<dev="tikz">>= for figures. For simplicity, I first will try to explain my problem without providing a minimal working example: I am using the ...
user144921's user avatar

1
2 3 4 5
12