, R . , , .. . R . S-PLUS, R. , , , , : . R:
> dotchart(Titanic[,,"Adult","No"],
. 2.3. . -
+ main=␣␣"")
Titanic , , . ( ) . R 3, . R (, rgl, OpenGL), , , R Trellis graphs -:
> coplot(log(Volume) ~ log(Girth) | Height, data = trees)
( ) . , . , -, - S-PLUS.
, (, ) , . , , . , R , R , , . , :
> plot(1:20)
> text(locator(), "␣␣", pos=4)
, , . identify(), rggobi, TeachingDemos iplot.
|
|
R (, ) R . , . (, ), . , . , . write.table():
> write.table(file="trees.csv", trees, + row.names=F, sep=";", quote=F)
trees.csv, R trees. , ? sink():
> sink("1.txt", split=T)
> 2+2 [1] 4
> sink()
[1] 4, . , , , - :
> print("2+2") [1] "2+2"
> 2+2 [1] 4
. savehistory(), save.image(). - , .
2.4.
, R, , , L ATEX ([1]) HTML, xtable. , , - R-. HTML , R2HTML CRAN:
> library(R2HTML)
> dir.create("example")
> HTMLStart("example") HTML
> 2+2 HTML
> plot(1:20) HTML
> HTMLplot() HTML
> HTMLStop()
>
example HTML-, , . . , , R, , R , ? literate programming ( ) , TEX. R , R . , , c L ATEX- , , test-Sweave.Rnw:
\documentclass[a4paper,12pt]{scrartcl} % \LaTeX- \usepackage[T2A]{fontenc} % utf8 % cp1251 koi8-r \usepackage[utf8]{inputenc} \usepackage[english,russian]{babel} \usepackage{indentfirst}
\title{ Sweave} \author{..\,} \begin{document} % \maketitle
\textsf{R} : <<echo=TRUE,print=TRUE>>= 1 + 1 1 + pi sin(pi/2) @
|
|
: <<fig=TRUE>>= plot(1:20) @
\end{document}
R:
> Sweave("test-Sweave.Rnw") Writing to file test-Sweave.tex Processing code chunks... 1: echo print term verbatim 2: echo term verbatim eps pdf
You can now run LaTeX on test-Sweave.tex
L ATEX- test-Sweave.tex. , , latex/dvips pdflatex :
=> latex test-Sweave.tex => dvips test-Sweave.dvi => gv test-Sweave.ps
. 2.5. Sweave
# => pdflatex test-Sweave.tex => acroread test-Sweave.pdf
, , , . , R , L ATEX- Rnw- :
\usepackage[noae]{Sweave}
(Friedrich Leisch) : http://www.ci.tuwien.ac.at/~leisch/Sweave/. , , R2HTML HTML. brew, (, ), odfWeave, ODF ( OpenOffice.org).