sweave

Custom graphical device in Sweave

不打扰是莪最后的温柔 提交于 2019-12-04 04:10:02
问题 My problem of inserting a pdf graphic with a special character in a Sweave document has been solved by creating the pdf plot outside Sweave itself and then importing it. Following the Sweave documentation, I have written a custom graphical device which should construct the pdf graphic exactly in the same way. However it doesn't work. Can you explain me why the second graphic of the Sweave document below does not work whereas it should be created exactly as the first one ? Am I wrong to

Insert manually created markdown table in Sweave document

杀马特。学长 韩版系。学妹 提交于 2019-12-04 02:06:05
问题 I have a bunch of quite big tables in markdown that I created manually. I was using them in an Rmd document. Since I need more control with LaTeX and all, I am using a Rnw document. How can I put my markdown table in the Sweave file? Below a minimal example (not working): \documentclass{article} \begin{document} \SweaveOpts{concordance=TRUE} % my markdown table col1 | col2 | col3 ------|:---:|:---: row1 | cell1 | cell2 row2 | cell3 | cell4 row3 | cell5 | cell6 \end{document} I've tried to

Print LaTeX Table Directly to an Image (PNG or other)

北慕城南 提交于 2019-12-04 01:41:54
Is there a way to print, from within R, a LaTeX table directly to an image file (for inclusion in another document/webpage). Basically, I'd like to supply LaTeX code to a function that saves it as an image to the working directory. Pipe dreams? There are various LaTeX-to-Image converter scripts, designed to do things like convert equations into images for including on web pages. If you can find one of those (dvipng perhaps?) then you can go from a table in R to LaTeX easy enough and then from LaTeX to png. If you have dvipng, you can leverage Hmisc's latex conversions to make a neater function

Make Sweave + RweaveHTML put all graphics in a specified folder

浪尽此生 提交于 2019-12-03 15:31:51
As a refinement of this question , does anyone know how to tell Sweave (or better the driver) to put all the graphics in a specific directory when using the RweaveHTML driver from the R2HTML package? I can't find any option for that :( Sweave responds to the prefix.string option for figures. E.g. in one recent document I use \SweaveOpts{engine=R,eps=FALSE,echo=TRUE,prefix.string=figures/chart} which leads to files figures/chart-chunkname.pdf where I use chunkname as the identifier in the Sweave code snippet. I suspect the same may help for R2HTML but I have not tried that driver. 来源: https:/

How to install the knitr-module in Lyx 2.0.3?

守給你的承諾、 提交于 2019-12-03 13:13:26
问题 I just installed Lyx 2.0.3 on my iMac and MacBook Air. When trying to open a *.lyx document on the iMac I get the following error-message: "The module knitr has been requested by this document but has not been found in the list of available modules. If you recently installed it, you probably need to reconfigure LyX." On the MacBook Air everything runs fine without any errors. Any ideas how to install the knitr-module manually? Thanks 回答1: The only requirement of the knitr module in LyX is R:

R Sweave: NO TeX installation detected

此生再无相见时 提交于 2019-12-03 08:44:21
I've tried searching on google to fix this, with very minimal helpful solutions. I have installed, Miktex, R and R studio. I would like to use Sweave to create PDF documents in Miktex. Everytime I open my .Rnw file, it gives a warning at the top which reads "No TeX installation detected. Please install TeX before compiling" When I look for pdflatex on my system with the command Sys.which("pdflatex") it returns "" Does anyone know how to fix this? ANYTHING at all at this point would be useful. Usually Rstudio finds the correct path to your Latex installation automatically. In your case that

How to write an if-then statement in LaTeX using the value of an R variable in knitr/Sweave

陌路散爱 提交于 2019-12-03 08:13:52
I am currently using knitr along with R 3.0.2 and RStudio in order to produce a LaTeX report. My report is typed up as a .Rnw file, and compiled using the knit2pdf function. I would like to use an if-then formulation in LaTeX in order to create a separate section, but have the if-then condition use the value of a variable from R (let's call it CreateOptionalSection ). Is this possible? If so, how can I refer to the R variable in the .tex document? Add \usepackage{comment} to the preamble of your latex file. At the line before the optional section starts, do <<startcomment, results='asis', echo

How to automatically create BibTex citations for R packages in knitr file?

安稳与你 提交于 2019-12-03 05:55:35
I am not sure whether this an R, LaTeX, or BibTex problem. I am trying to automatically generate a .bib file containing citations for R packages and then list them at the end. I am able to generate the BibTex file and I don't see anything wrong with the BibTex file, but the entries don't appear when I compile the PDF. I'm not sure if R is not producing a BibTex file correctly, if some LaTeX syntax is wrong, or if the BibTex file needs to be pre-compiled or whatever. I noticed that \bibliography{NOT A REAL FILENAME} will produce a References section without complaining, but I don't think that

Sweave Cache packages

孤街浪徒 提交于 2019-12-03 05:35:19
I am trying to sweave a report and my problem is that every time i compile R loads the packages I use in the Report (like ggplot2, MASS, cubature..). This is very time consuming. Is there a way to chache the packages? I found cacheSweave but it does not work. This is the chunk i added in the sweave file: <<cacheSweave, eval=TRUE, echo=FALSE, term=FALSE, cache=TRUE>>= library(cacheSweave) lapply(c("ghyp","MASS","nloptr","cubature","ggplot2"), require, character.only=T) @ Thanks Since you showed interest in the knitr package, I spent some time implementing this feature, and you can download the

two column beamer/sweave slide with grid graphic

独自空忆成欢 提交于 2019-12-03 04:25:29
问题 I'm trying to make a presentation on ggplot2 graphics using beamer + sweave. Some slides should have two columns; the left one for the code, the right one for the resulting graphic. Here's what I tried, \documentclass[xcolor=dvipsnames]{beamer} \usepackage{/Library/Frameworks/R.framework/Resources/share/texmf/tex/latex/Sweave} \usepackage[english]{babel} \usepackage{tikz} \usepackage{amsmath,amssymb}% AMS standards \usepackage{listings} \usetheme{Madrid} \usecolortheme{dove} \usecolortheme