
(1)numeric資料格式
1: > x=c(1,2,3,4)
2: > x
3: [1] 1 2 3 4
4: > class(x)
5: [1] "numeric"
me1237guy 發表在 痞客邦 留言(0) 人氣(317)

查看目前系統包含哪些library
> library()
C:\Program Files\R\R-3.1.2\library 可以找到對應的library資料夾載入某一個library例如boot
library(boot)
me1237guy 發表在 痞客邦 留言(0) 人氣(747)

Writing your own functions計算兩點距離
1: > calDist<-function(x1, x2){ 2: + d = x1 - x2;
3: + dist = d * d;
4: + sdist = sqrt( sum(dist) );
5: + sdist
6: + }
me1237guy 發表在 痞客邦 留言(0) 人氣(156)

Reading data from filesread.table() 或是 scan()利用read.table讀取houses.txt
1: > HousePrice <- read.table("C:\\statistics R\\houses.txt") 2: > HousePrice
3: Price Floor Area Rooms Age Cent.heat
4: 01 52.00 111 830 5 6.2 no
5: 02 54.75 128 710 5 7.5 no
6: 03 57.50 101 1000 5 4.2 no
7: 04 57.50 131 690 6 8.8 no
8: 05 59.75 93 900 5 1.9 yes
me1237guy 發表在 痞客邦 留言(0) 人氣(110)

R-(D)COM Interface (for Windows) contains a COM server used to connect a client application (e.g., Microsoft Excel) with R. An Add-In for Microsoft Excel is provided as well as Active X controls to be included in your applicationsC:\Program Files (x86)\statconn\DCOM預設只有勾選前兩項
---------------------------------------------------------------------------------------------------------------------------------
me1237guy 發表在 痞客邦 留言(0) 人氣(82)
array( 初始值, 維度) 產生2x3陣列裡面元素為0
1: > x<-array(0, dim=c(2,3))
2: > x
3: [,1] [,2] [,3]
4: [1,] 0 0 0
5: [2,] 0 0 0
me1237guy 發表在 痞客邦 留言(0) 人氣(57)

下載各類工具套件 http://CRAN.R-project.orgR-intro.pdf為官方手冊,值得初學者研讀線上中文版: R 導論
宣告一個變數名稱為 x 的向量, 其中 <- 為指派運算子(assign operator)
1: > x <- c(1, 2, 3, 4, 5)
2: > x
3: [1] 1 2 3 4 5
me1237guy 發表在 痞客邦 留言(0) 人氣(903)
me1237guy 發表在 痞客邦 留言(0) 人氣(178)