Almost started with sweave

my question may be less general than the name suggests. I am running R on Mac OS X with a MySQL database to store data. I have been working with Komodo / Sciviews-R for a while. Recently, I had a need to create automatically generated reports and view Sweave. I believe StatET / Eclipse is the "standard" solution for Sweavers.

1) Can I switch from Komodo to StatET Eclipse? I tried Statet before, but chose Komodo over StatET because I liked calltip / autosuggest and the more convenient configuration from Komodo.

2) What is the smart workflow for creating sweave files? I usually develop my R code first, and then take care of it later. I just found out today that there is one file in Sweave that contains the R code and the latex code right away, and a .tex document is created from this file. While the sample files look comfortable and cannot imagine how to enter my 250+ lines of R code into the file and mix it with Latex.

Is it possible to simply enter the qplot () and ggplot () operators in such a document and somehow run functions such as connecting to the database and intermediate results?

Or is it just a matter of using a combination of Latex and R?

thanks for any suggestions, tips, links and back to the roots of screams ...

+3
source share
3 answers

, :

StatEt/Eclipse Sweave?

(: StatEt/Eclipse R, Sweave/R , Komodo/sciviews-R). sweave R, .tex . .tex (, pdf) tex.

Sweave?

r script sweave-, sweave / R script sweave R- , ..

<<label=myEntireRScript, echo=false, include=false>> 
#Insert code here
myTable<-dataframe(...)
myPlot<-qplot(....)
@ 

, . , , R xxtable, .

<<label=myEntireRScript, echo=false, include=false>>=  
#Insert code here
@ 
Put any text I want before my table here, maybe with a \Sexpr{print(variable)} named variable

<<label=myTable, result=Tex>>= 
myTable<-dataframe(...)
print(xtable(mytable,...),...)
@ 
Any text I want before my figure
<label=myplot, result=figure>>= 
myPlot<-qplot(....)
print(qplot)
@ 
+8

fooobar.com/questions/1737567/... . 2.

Sweave R . R- , .Rnw - :

<<>>
source('/path/to/script.r')
@

, R , R script - :

Sweave('/path/to/report.Rnw'); system('pdflatex report.tex')

, , R-. R, Sweave, , , , .

+7

nullglob, R Sweave , save.image(), source() . R .Rnw( , ).

- / R . "", save.image(), .

.Rnw setwd() load(".Rdata"). , , , . , R, , .Rnw, R... save.image() .

I am on a Mac and I suggest TextMate if you played softly and emacs / ess if you are really defiant. I use vim and the R command line, but emacs / ess works best for most. If you have been in this for a long time, I doubt that you will regret studying emacs / ess for R, Sweave and LaTeX.

+6
source

Source: https://habr.com/ru/post/1755691/


All Articles