# R語言統計 --- ### Week1 setwd()設定預設資料夾位置 getwd()取得預設資料夾位置 require()呼叫套件 library()呼叫套件 ``` require() will output a warning if a package is not installed and then continue to execute the code. library() will output an error and "stop" the execution of the code. ``` --- ### Week2 seq(x) 產生X範圍的集合 mean 中位數 sd 標準差 boxplot(屬量~屬值) 盒鬚圖 hist(data) 柱狀圖 a<-10 建立變數a並設值為10 ``` 資料集: iris diamonds ``` head() 輸出前六筆資料 tail() 輸出後六筆資料 attach() 預設使用此變數 --- ### Week3 資料載入: csv->library(readr) xlsx->library(xlsx) Rdata->load() 圖表: | 類型 | 屬值 | 屬量 | | ------ |:--------------:|:--------------------------:| | 圖表 | 值方圖、長條圖 | 盒鬚圖(分組、圖層)、散佈圖 | | 變數量 | 1 | 1~3 | p.s 屬量: 一個變數:盒鬚圖 兩個變數: 1. 屬量v.s屬量:散佈圖 2. 屬值v.s屬量:盒鬚圖 分組 三個或以上:屬值v.s屬量:盒鬚圖 分組(多圖層)  --- ### Week4 **c():也就是combine類似於array data.frame():也就是DataFrame類似於list in python** int->boolean `as.logical(combine or variable)` int->str `as.charactor(combine or variable)` boolean or str->int `as.numeric(conbine or variable)` get combine's length `length(combine)`  --- ### Week5 pie() 圓餅圖 boxplot(x~y) plot(data,type='') | type | mean | | -------- | -------- | |l|折線圖| |p|點圖 | |b|折線與點圖| |h|高度| |s|階梯| ggplot: ggplot(data,aes(y=,x=)+geom...) | plot_type | mean | | -------- | -------- | | geom_point | 散佈圖 | | geom_bar | 盒鬚圖 | | geom_line | 直線圖 | | geom_bloxplot | 盒鬚圖 | | geom_violin | 小提琴圖 | --- ### Week6 Dianmond資料集 --- ### Week9 dplyr套件:管線符號 ```r x %>% log %>% sqrt %>% mean ``` 等同於 ```r mean(sqrt(log(x))) ``` ### Week10 差異分析:  **1122R07R統計檢定1.pptx P.14 (重要)** unique() 數量資料查詢(不重複) mean() 平均 sd() 標準差 less = 左尾檢定 greater =右尾檢定 ### Week11 **1122R08R統計檢定1.pptx P.17 (重要&作業)**
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up