Download presentation
Presentation is loading. Please wait.
Published bySibyl Angel Logan Modified over 8 years ago
1
Statistical analysis - R Language Open Source R R Studio
2
R 是什麼 ? 統計軟體 – 繪製資料圖表 – 互動式操作 統計程式語言 – 基於 S 語言實作
3
What is R? The R statistical programming language is a free open source package based on the S language developed by Bell Labs. The language is very powerful for writing programs. Many statistical functions are already built in. Contributed packages expand the functionality to cutting edge research. Since it is a programming language, generating computer code to complete tasks is required.
4
History of R S: language for data analysis developed at Bell Labs circa 1976 Licensed by AT&T/Lucent to Insightful Corp. Product name: S-plus. R: initially written & released as an open source software by Ross Ihaka and Robert Gentleman at U Auckland during 90s (R plays on name “ S ” ) Since 1997: international R-core team ~15 people & 1000s of code writers and statisticians happy to share their libraries! AWESOME!
5
What is it? R is an interpreted computer language. – Most user-visible functions are written in R itself, calling upon a smaller set of internal primitives. – It is possible to interface procedures written in C, C+, or FORTRAN languages for efficiency, and to write additional primitives. – System commands can be called from within R R is used for data manipulation, statistics, and graphics. It is made up of: – operators (+ - <- * %*% …) for calculations on arrays & matrices – large, coherent, integrated collection of functions – facilities for making unlimited types of publication quality graphics – user written functions & sets of functions (packages); 800+ contributed packages so far & growing
6
There are over 800 add-on packages ( http://cran.r-project.org/src/contrib/PACKAGES.html ) This is an enormous advantage - new techniques available without delay, and they can be performed using the R language you already know. Allows you to build a customized statistical program suited to your own needs. Downside = as the number of packages grows, it is becoming difficult to choose the best package for your needs, & QC is an issue.
7
R Objects Almost all things in R – functions, datasets, results, etc. – are OBJECTS. – (graphics are written out and are not stored as objects) Script can be thought of as a way to make objects. Your goal is usually to write a script that, by its end, has created the objects (e.g., statistical results) and graphics you need. Objects are classified by two criteria: – MODE: how objects are stored in R - character, numeric, logical, factor, list, & function – CLASS: how objects are treated by functions (important to know!) - [vector], matrix, array, data.frame, & hundreds of special classes created by specific functions
8
Data Analysis and Presentation The R distribution contains functionality for large number of statistical procedures. – linear and generalized linear models – nonlinear regression models – time series analysis – classical parametric and nonparametric tests – clustering – smoothing R also has a large set of functions which provide a flexible graphical environment for creating various kinds of data presentations.
9
R 網站 網站請參閱 www.r-project.org
10
R 工具下載 按下 Download ,選擇下載點
11
如何與 R 連接 ? Packages – install.packages
12
整合 (Java) 熟悉 Java 開發者 – Set environment path – Import jri.jar – Have fun!
13
整合 (Java)
14
R Studio 開發環境 便利的開發環境 請參閱 www.rstudio.com
16
R Studio 操作介面 左側:上方撰寫程式碼與下方執行程式碼 (Console 介面 )
17
R Studio 操作介面 右側:各種設定與執行狀態的紀錄
18
R Studio 工具的執行狀態紀錄 Environment :記錄目前變數的數值 History :記錄在 Console 執行過的程式碼 Files :記錄目前工作環境所在的目錄 Plots :呈現圖表 Packages :記錄目前已安裝的 Package Help :查詢文件 Viewer :顯示網頁
19
R data type Numeric – 在 R 中預設的資料格式 – 若未指定資料格式,雖然將某個整數 (integer) 傳到變數中, 該變數還是預設為 Numeric Character – 利用 ” 引號 ” 來傳入字串 Integer – 整數,若未指定資料格式會預設為 Numeric Complex – 實數 (real) + 虛數 (imaginary) 用 a + bi 表示 Logical – True 與 False
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.