没有合适的资源?快使用搜索试试~ 我知道了~
R软件初步者学习书籍,全英文版。
资源推荐
资源详情
资源评论
R for Beginners
Emmanuel Paradis
Institut des Sciences de l’
´
Evolution
Universit´e Montpellier II
F-34095 Montpellier c´edex 05
France
E-mail: paradis@isem.univ-montp2.fr
I thank Julien Claude, Christophe Declercq,
´
Elodie Gazave, Friedrich Leisch,
Louis Luangkesron, Fran¸cois Pinard, and Mathieu Ros for their comments and
suggestions on earlier versions of this document. I am also grateful to all the
members of the R Development Core Team for their considerable efforts in
developing R and animating the discussion list ‘rhelp’. Thanks also to the
R users whose questions or comments helped me to write “R for Beginners”.
Special thanks to Jorge Ahumada for the Spanish translation.
c
2002, 2005, Emmanuel Paradis (12th September 2005)
Permission is granted to make and distribute copies, either in part or in
full and in any language, of this document on any support provided the above
copyright notice is included in all copies. Permission is granted to translate
this document, either in part or in full, in any language provided the above
copyright notice is included.
Contents
1 Preamble 1
2 A few concepts before starting 3
2.1 How R works . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Creating, listing and deleting the objects in memory . . . . . . 5
2.3 The on-line help . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 Data with R 9
3.1 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Reading data in a file . . . . . . . . . . . . . . . . . . . . . . . 11
3.3 Saving data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.4 Generating data . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.4.1 Regular sequences . . . . . . . . . . . . . . . . . . . . . 15
3.4.2 Random sequences . . . . . . . . . . . . . . . . . . . . . 17
3.5 Manipulating objects . . . . . . . . . . . . . . . . . . . . . . . . 18
3.5.1 Creating objects . . . . . . . . . . . . . . . . . . . . . . 18
3.5.2 Converting objects . . . . . . . . . . . . . . . . . . . . . 23
3.5.3 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.5.4 Accessing the values of an object: the indexing system . 26
3.5.5 Accessing the values of an object with names . . . . . . 29
3.5.6 The data editor . . . . . . . . . . . . . . . . . . . . . . . 31
3.5.7 Arithmetics and simple functions . . . . . . . . . . . . . 31
3.5.8 Matrix computation . . . . . . . . . . . . . . . . . . . . 33
4 Graphics with R 36
4.1 Managing graphics . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.1.1 Opening several graphical devices . . . . . . . . . . . . . 36
4.1.2 Partitioning a graphic . . . . . . . . . . . . . . . . . . . 37
4.2 Graphical functions . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.3 Low-level plotting commands . . . . . . . . . . . . . . . . . . . 41
4.4 Graphical parameters . . . . . . . . . . . . . . . . . . . . . . . 43
4.5 A practical example . . . . . . . . . . . . . . . . . . . . . . . . 44
4.6 The grid and lattice packages . . . . . . . . . . . . . . . . . . . 48
5 Statistical analyses with R 55
5.1 A simple example of analysis of variance . . . . . . . . . . . . . 55
5.2 Formulae . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.3 Generic functions . . . . . . . . . . . . . . . . . . . . . . . . . . 58
5.4 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
1 Preamble
The goal of the present document is to give a starting point for people newly
interested in R. I chose to emphasize on the understanding of how R works,
with the aim of a beginner, rather than expert, use. Given that the possibilities
offered by R are vast, it is useful to a beginner to get some notions and
concepts in order to progress easily. I tried to simplify the explanations as
much as I could to make them understandable by all, while giving useful
details, sometimes with tables.
R is a system for statistical analyses and graphics created by Ross Ihaka
and Robert Gentleman
1
. R is both a software and a language considered as a
dialect of the S language created by the AT&T Bell Laboratories. S is available
as the software S-PLUS commercialized by Insightful
2
. There are important
differences in the designs of R and of S: those who want to know more on this
point can read the paper by Ihaka & Gentleman (1996) or the R-FAQ
3
, a copy
of which is also distributed with R.
R is freely distributed under the terms of the GNU General Public Licence
4
;
its development and distribution are carried out by several statisticians known
as the R Development Core Team.
R is available in several forms: the sources (written mainly in C and
some routines in Fortran), essentially for Unix and Linux machines, or some
pre-compiled binaries for Windows, Linux, and Macintosh. The files needed
to install R, either from the sources or from the pre-compiled binaries, are
distributed from the internet site of the Comprehensive R Archive Network
(CRAN)
5
where the instructions for the installation are also available. Re-
garding the distributions of Linux (Debian, . . . ), the binaries are generally
available for the most recent versions; look at the CRAN site if necessary.
R has many functions for statistical analyses and graphics; the latter are
visualized immediately in their own window and can be saved in various for-
mats (jpg, png, bmp, ps, pdf, emf, pictex, xfig; the available formats may
depend on the operating system). The results from a statistical analysis are
displayed on the screen, some intermediate results (P-values, regression coef-
ficients, residuals, . . . ) can be saved, written in a file, or used in subsequent
analyses.
The R language allows the user, for instance, to program loops to suc-
cessively analyse several data sets. It is also possible to combine in a single
program different statistical functions to perform more complex analyses. The
1
Ihaka R. & Gentleman R. 1996. R: a language for data analysis and graphics. Journal
of Computational and Graphical Statistics 5: 299–314.
2
See
http://www.insightful.com/products/splus/default.asp for more information
3
http://cran.r-project.org/doc/FAQ/R-FAQ.html
4
For more information:
http://www.gnu.org/
5
http://cran.r-project.org/
1
剩余75页未读,继续阅读
资源评论
leetle_rascal
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功