码迷,mamicode.com
首页 > 其他好文 > 详细

R fundamental 1

时间:2016-03-02 17:52:01      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:

1.1 R Environment

It is doable to run on the systems like Windows、 Linux and Unix. The most convience way to manipulate R is through graphies interface.

1.2 Interactively

All command work through a prompt and default prompt is ‘>‘, which could be the same either on Linux or Windows shell prompt.

1.3 Getting help

R has a build-in help facility. The command is

>help(object)

An alternative is

>?object

If a command is not finished at the end of a line, R will give a default symbol ‘+‘, and it will read the input from second line or subsequent lines until command is done.

2. 1 Numbers and Vectors

R operates on named data structures. The very simplest one is numeric vector.The keyword is ‘c‘ and assignment operator ‘<-‘. For example, to set up a vector named x, concludes total 3 numbers, namely 1, 2, 3, the command is

> x <- c(1, 2, 3)

or in the oppsite direction

> c(1, 2, 3) -> x

Assignment can also be done using by function ‘assign()‘.

> assign("x", c(1, 2, 3))

2.2 Arithmetic

Just use arithmetic expressions can fulfill the calculation needs. The elementary arithmetic operators are the usual ‘+, -, *, /, ^‘. Additional operators includes ‘min, max, length, sum, log, exp, sin, cos, tan, sqrt...‘. Symbol "i" for the complex numbers.

 

R fundamental 1

标签:

原文地址:http://www.cnblogs.com/raulyy/p/5235626.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!