好文档 - 专业文书写作范文服务资料分享网站

R统计软件详细介绍(中文版)

天下 分享 时间: 加入收藏 我要投稿 点赞

E

Sweave文档????????→TEX文档??????→最终pdf文档

dvipdfmx

Sweave(inR)ALTX

150.如何释放R运行后占用的内存?

使用函数

1

gc()

因为R是在内存中运算,所以当R读入了体积比较大的数据后,即使删除了相关对象,内存空间

仍不能释放。gc()函数虽然主要用来报告内存使用情况,但是一个重要的用途便是释放内存。

151.用什么文本编辑器比较好?

比较常用的是Tinn–R,RWinEdt9,ESS(EmacsSpeaksStatistics),甚至任意一款编辑器,如UltraEdit10,这些都支持R语法的高亮显示。如果是Windows桌面环境下的用户,对这些不是很了解,记事本也不失为一种选择。

9下载、安装

10需要下载、修改

WinEdt后,在R中安装RWinEdt包即可使用

word?le

35

附录ASweave例

\\documentclass[CJK]{cctart}\%usepackage{verbatim}\\title{Sweave实例}\\author{}\\date{}

\\SweaveOpts{echo=FALSE}\\begin{document}\\maketitle

使用Sweave可以很容易地将\\LaTeX{}同R的代码混排文档转化为可编译的\\LaTeX{}文档。

在这种混排的文档里,基本结构仍然是\\LaTeX{}形式的,唯一的区别是,R代码需要放置在以$<<>>=$为开头,$@$为结尾的段落里面。开头部分有两个常用的参数:echo和fig,使用逻辑值分别表示是否将R代码输入作为\\LaTeX{}文本输出;是否在\\LaTeX{}文档中绘制图形。

这篇文档只需要在R中编译一遍,即可形成\\LaTeX{}需要的输出(文件)。下面是一个配对t检验的一个例子:<>=require(stats)

##Student’spairedt-test

m<-t.test(extra?group,data=sleep,paired=TRUE)print(m)@

R在计算过程中生成的的中间结果很容易插入到标准文档,比如\\texttt{sleep}数据的双样本的配对t检验结果中的$p$-value是\\Sexpr{format.pval(m$p.value)};或者是直接运算

<>=choose(49,6)@

美国威力球(类似于福彩双色球)的理论组合数等于\\Sexpr{choose(49,6)}。通过这种方法处理‘‘有大量计算’’的文档,比word不知方便多少倍。

36

R代码中可以随意写注释,但这些注释默认不会被输出。如果要求输出注释,抱歉,现在还没有更好的解决办法。

使用Sweave还可以将R生成的图形加入到\\LaTeX{}文档中,而不必事先做出\\LaTeX{}需要的图形文件\\footnote{Sweave会自动生成ps和pdf图形}。下图是根据Titanic号海难中人员的经济状况、性别、年龄和是否存活四个变量绘制的马赛克图:<>=require(graphics)

mosaicplot(Titanic,main=\ontheTitanic\@

\\end{document}

c2008RandalltheContributorstoRFAQ.Allrightsreserved.Copyright??

c2008。保留所有权利。R以及RFAQ的作者拥有版权??

Permissionisgrantedtocopy,distributeand/ormodifythisdocumentunderthetermsoftheGNUFreeDocumentationLicense,Version1.2oranylaterversionpublishedbytheFreeSoftwareFoundation;withtheInvariantSectionsbeingContributors,noFront-CoverTexts,andnoBack-CoverTexts.

你可以拷贝、发布或者修改这份文档,但必须遵守自由软件组织颁布的GNU自由文档许可证1.2或者以后版本的条款。InvariantSections包括Contributors,没有Front-CoverTexts和Back-CoverTexts。

37

索引

Symbols

cm.colors....................23eigen........................15

\\\\............................9col...........................23ESS.........................35..............................18col2rgb......................23eval..........................10.packages.....................6colMeans....................16/.............................9colors........................23

%*%........................15combn.......................16?.........................16,30Commander.................34{}...........................12complex.....................15Acon?nt.......................31

abline.......................20con?nt.glm..................31

aggregate....................13con?nt.nls...................31

any..........................11contour......................25

aov..........................30

crossprod....................15

aperm.......................12

cumsum..................12,24

append......................10

curve........................24apply.................12,16,25cutree.......................29as.Date......................18

D

as.numeric...................20D............................16as.POSIXct..................18

data..........................6

axes.........................21

dataframe................6,12

axis..........................21

demo.........................3

B

detach........................5

barplot......................23dev.copy.....................24

boxcox.......................33dev.cur......................22bptest.......................33dev.list......................22Breusch-Pagan...............33dev.o?.......................22dev.set......................22CDevices......................22cancor.......................33diag.........................15capture.output................8di?time......................18

car........................7,33duplicated...................12

casefold......................17durbin.watson...............32choose.......................16dwtest.......................32citation.......................3clipboard.....................8

E

cluster.......................29edit...........................938

F

factanal......................29factorial.....................16FALSE......................12

?le.choose.....................9

?lled.contour................25

?vnum.......................14

?x............................9

format.......................18

Ggc...........................35

getAnywhere..................7

getwd.........................5glm..........................31gray.........................23grep.........................18grey.........................23grid.........................21

Hhat,hatvalues................31hclust.......................29head..........................7

heat.colors...................23

help..........................3

help.search....................3II.............................30identical.....................11

if............................12image........................25

integer.......................15

integrate.....................14ncv.test......................33read.table.....................8iris..........................20NULL.......................12read.xls.......................8is.na.........................10is.numeric...................13

J

O

optimize.....................17options.......................4

rect..........................26RegularExpressions......12,18rev..........................13

rgb..........................23

jarque.bera.test..............29outer........................15jpeg.........................23P

K

Package.......................5kmeans......................28par...............19,21,25,26

ks.test.......................29parplot......................26

parse........................10

Lpaste......................4,17

latex..........................9pch..........................20latex.table....................9pdf..........................23layout.......................19persp........................25lda..........................33pictex.......................23

legend.......................20pie..........................21

letters.......................23plotmath....................26

Library.......................5pmax........................13

library........................5pmin........................13

lines.........................24png..........................23

list...........................4points.......................19

lm...........................31poly.........................31

lmtest.......................33postscript....................23

loadings.....................29princomp....................29

lower.tri.....................16print..........................9

ls.............................4proc.time....................34

M

prompt.......................4

mai..........................19Q

mar.........................19qda..........................33matrix...................12,16qqnorm......................25memory.limit.................4qr.solve......................33merge.......................14QuantileRegression..........28methods......................7

RN

rainbow.....................23nchar........................18Rcmdr.......................3439

rm............................4

RMySQL....................10

rnorm................17,21,24

RODBC.....................10

rowMeans...................16

Rpad........................34

rpart........................32RSiteSearch...................3RWinEdt....................35S

sample.......................13

save..........................5

save.image....................5

savePlot.....................23

scale.........................14

screeplot.....................29

search........................6

sem..........................30

setwd.........................5

shapiro.test..................29

shell.exec.....................4

show.error.messages..........4

sink........................8,9some..........................7sort..........................21source........................9spline........................24split.screen..................19

sqrt..........................16stars.........................22

stats.........................29

stem.........................21

R统计软件详细介绍(中文版)

ESweave文档????????→TEX文档??????→最终pdf文档dvipdfmxSweave(inR)ALTX150.如何释放R运行后占用的内存?使用函数1gc()因为R是在内存中运算,所以当R读入了体积比较大的数据后,即使删除了相关对象,内存空间仍不能释放
推荐度:
点击下载文档文档为doc格式
6iz252s0h44x67j2pukt
领取福利

微信扫码领取福利

微信扫码分享