sweave

Emacs, R, Sweave: UTF-8 encoding is not recognized when launching Sweave through Emacs

 ̄綄美尐妖づ 提交于 2019-12-10 14:54:30
问题 I work with Emacs 24 on Mac OS X 10.7.3 with R 2.14.0. I have a file foo.Rnw containing \documentclass[ paper=a4,% 210mm × 297mm pagesize% write page size to dvi ]{article} \usepackage[american]{babel} \usepackage{fancyvrb} \usepackage[utf8]{inputenc} \SweaveOpts{engine=R} \SweaveOpts{pdf=TRUE} \begin{document} Some text <<>>= sessionInfo() @ \end{document} My .emacs for working with Sweave looks like this: (add-hook 'Rnw-mode-hook (lambda () (add-to-list 'TeX-command-list '("Sweave" "R CMD

knitr: Knitting separate Rnw documents within an Rmd document

橙三吉。 提交于 2019-12-10 14:49:22
问题 I have a master R markdown document (Rmd) within which I would like to knit several separate Rnw documents (NO child documents) in one of the chunks. However, when I call knit on the Rnw document, the contained R code chunks do not seem to be processed, resulting in an error when trying to run texi2pdf on them. Illustration of the situation: Inside master. Rmd : ```{r my_chunk, echo=FALSE, message=FALSE, results='asis'} ... some code ... knit("sub.**Rnw**", output = ..., quiet = TRUE) tools:

How can I include hyperlinks in a table within an Sweave document?

若如初见. 提交于 2019-12-10 13:33:15
问题 I have a data frame containing hyperlinks that I would like to present as clickable links using Sweave . I know about xtable , but am not sure how to use it to treat the contents of a data frame as LaTeX commands. 回答1: One strategy is to use the sanitize.text.function from the print function in xtable . Setting sanitize.text.function = function(x){x} causes print simply to echo the contents of the data frame for later interpretation by LaTeX: \documentclass{article} \usepackage{hyperref}

Writing an R package vignette that reads in an example file?

久未见 提交于 2019-12-10 13:12:48
问题 I'm trying to write a vignette for a package in R. I've been following a tutorial from Vanderbilt University as well as the offical documentation. I made a .Rnw Sweave file and put it into a subdirectory inst/doc inside my package. Inside the same subdirectory inst/doc , I put a folder example containing some example text files. My package has a function myparser(path) that I want to demonstrate in the vignette; myparser(path) creates several data frames by reading in the text files inside

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

对着背影说爱祢 提交于 2019-12-09 14:59:57
问题 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? 回答1: 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

Sweave Cache packages

廉价感情. 提交于 2019-12-09 05:21:41
问题 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 回答1: Since you

Outputting character string elements neatly in Sweave in R

泪湿孤枕 提交于 2019-12-08 11:15:08
问题 I have a character string that I would like to output in a better format. Currently, my program is something like this: \documentclass[12pt,english,nohyper]{tufte-handout} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{longtable} \usepackage{wrapfig} \usepackaage{hyperref} \usepackage{graphicx} \usepackage[space]{grffile} \usepackage{geometry} \makeatletter \makeatother \begin{document} \SweaveOpts{concordance=TRUE} <<include=FALSE>>= library(ggplot2) library(reshape2)

Rreport/LaTeX quality output package

本小妞迷上赌 提交于 2019-12-07 20:19:13
问题 I'm looking for some LaTeX template for creating quality output. On R-bloggers I've bumped on Frank Harrel's Rreport package. Due to my quite modest LaTeX abilities, only a user-friendly (and noob-friendly) interface should suffice. Here's a link to an official website. I'm following the instructions, but I cannot manage to install an app. I use Ubuntu 9.10, R version is 2.10.1 (updated regularly from UCLA's CRAN server), and of course, cvs is installed on my system. Now, I'd like to know if

sweave, xtable, longtable and alternating row colors…problems with `add.to.row`

旧巷老猫 提交于 2019-12-07 18:04:47
问题 This existing question covers a way to alternate row colors in a latex table by post-processing the output from print.xtable() , but I think it's possible to achieve the same thing by using the add.to.row argument of print.xtable() as described on stats.stackexchange, avoiding the need for post-processing, which is nice with Sweave. That answer deals with coloring the background of one specific row, but I think it can be extended to coloring all the odd rows. The problem I'm running into has

Trying to understand the workflow between latex, sweave and R

时光总嘲笑我的痴心妄想 提交于 2019-12-07 17:45:31
问题 Let's say I have written the following tiny .Rnw file: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{Sweave} \usepackage{tikz} \usepackage{pgf} \begin{document} <<>>= sessionInfo() @ \end{document} I then can go to R and use sweave to translate the .Rnw file into a .tex file Once this is done the latex interpreter can be called and because I used \usepackage{Sweave} Latex knows how to handle the sweave specific code tags. When I first did this procedure I got the common