sweave

R: Print two tables with xtable ()

心已入冬 提交于 2019-12-03 03:58:42
问题 I have data tables (d1 and d2) which I would like to print side by side or on top of each other in latex with their own individual titles. Is it possible to do that directly with xtable() ? The two tables should be distinct, i.e. we could call them Table x(a) and Table x(b) , but they should be either adjacent, or stacked. 回答1: I would recommend saving the results as two separate tables in different files (see the file= option to print.xtable() ), and then input them into your LaTeX document

How to put a newline into a column header in an xtable in R

放肆的年华 提交于 2019-12-03 03:54:44
问题 I have a dataframe that I am putting into a sweave document using xtable, however one of my column names is quite long, and I would like to break it over two lines to save space calqc_table<-structure(list(RUNID = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ANALYTEINDEX = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ID = structure(1:11, .Label = c("Cal A", "Cal B", "Cal C", "Cal D", "Cal E", "Cal F", "Cal G", "Cal H", "Cal High", "Cal Low", "Cal Mid"), class = "factor"), mean_conc = c

How to install the knitr-module in Lyx 2.0.3?

南笙酒味 提交于 2019-12-03 03:32:55
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 The only requirement of the knitr module in LyX is R: you have to make sure the executable Rscript is in your PATH; you can test it by: which Rscript If you see

Column names on each page with xtable in Sweave

让人想犯罪 __ 提交于 2019-12-03 03:17:02
I want to have column names on each page of the xtable. \documentclass{article} \usepackage{graphicx} \usepackage{longtable} \begin{document} <<>>= x <- matrix(rnorm(1000), ncol = 10) x.big <- xtable(x,label='tabbig',caption='Example of longtable spanning several pages') @ <<label = tabSEM.S, echo = FALSE, results = tex >>= print(x.big,tabular.environment='longtable',floating=FALSE) @ \end{document} Any help will be highly appreciated. Thanks joran I think this is really a LaTeX question, which I simply Googled and ended up with a simple answer from tex.stackexchange.com here . Try this

Sweave for python

六月ゝ 毕业季﹏ 提交于 2019-12-03 02:10:41
问题 I've recently started using Sweave* for creating reports of analyses run with R, and am now looking to do the same with my python scripts. I've found references to embedding python in Sweave docs, but that seems like a bit of a hack. Has anyone worked out a better solution, or is there an equivalent for python I'm not aware of? * Sweave is a tool that allows to embed the R code for complete data analyses in latex documents 回答1: I don't believe that there's a direct equivalent, so Romain

Writing big documents with Sweave. Is it possible to do as with LaTeX?

£可爱£侵袭症+ 提交于 2019-12-03 01:30:49
问题 I am just discovering Sweave and R . I have seen some examples of Sweave documents and have also started to write one or two on my own. I am impressed by the ability of doing computations in R and outputting results directly in a LaTeX document. Now I am thinking of bigger documents (as we usually have with LaTeX ) that consist of several pages and several parts. With LaTeX (I use WinEdt), I set a main document (e.g. main.tex ) and then have other subsidiary documents like introduction.tex ,

More efficient R / Sweave / TeXShop work-flow?

给你一囗甜甜゛ 提交于 2019-12-03 01:13:39
问题 I've now got everything to work properly on my Mac OS X 10.6 machine so that I can create decent looking LaTeX documents with Sweave that include snippets of R code, output, and LaTeX formatting together. Unfortunately, I feel like my work-flow is a bit clunky and inefficient: Using TextWrangler, I write LaTeX code and R code (surrounded by <<>>= above and @ below R code chunk) together in one .Rnw file. After saving changes, I call the .Rnw file from R using the Sweave command Sweave(file="

R / Sweave formatting numbers with \\Sexpr{} in scientific notation

故事扮演 提交于 2019-12-02 23:05:20
I am just starting to write some documents with Sweave/R and I like the \sexpr{} command that lets one tow write numbers directly within text. If I have a number like mus=0.0002433121 , well I can say round it to a number of decimal places e.g. \Sexpr{round(mus,7)} How to write it in the scientific notation i.e. as LaTeX would be outputting 2.43 \times 10^{-4} and can we control the number of significant digits to be outputted like 3 in this example? I note that a number like sigma = 2000000 is written automatically to 2e + 06 if I specify \Sexpr{round(sigma,2)}. I would prefer that it would

two column beamer/sweave slide with grid graphic

久未见 提交于 2019-12-02 18:44:45
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{rose} \SweaveOpts{pdf=TRUE, echo=FALSE, fig=FALSE, eps=FALSE, tidy=T, width=4, height=4} \title

R: Print two tables with xtable ()

无人久伴 提交于 2019-12-02 17:21:39
I have data tables (d1 and d2) which I would like to print side by side or on top of each other in latex with their own individual titles. Is it possible to do that directly with xtable() ? The two tables should be distinct, i.e. we could call them Table x(a) and Table x(b) , but they should be either adjacent, or stacked. I would recommend saving the results as two separate tables in different files (see the file= option to print.xtable() ), and then input them into your LaTeX document with any command you find appropriate for your layout ( tabular , subfloat , minipage , etc.). This is what