Wush Wu
2015年9月25日
shapiro.test(x)
Shapiro-Wilk normality test
data: x
W = 0.94356, p-value = 0.0003198
x1 <- rnorm(50)
x2 <- rt(50, df = 2)
plot(density(x1), xlim = range(c(x1, x2)), main = "Sample PDF")
lines(density(x2), col = 2)
legend("topright", c("x1", "x2"), lty = 1, col = 1:2)
ks.test(x1, x2)
Two-sample Kolmogorov-Smirnov test
data: x1 and x2
D = 0.24, p-value = 0.1124
alternative hypothesis: two-sided
# 假設方法A 真正的轉換率和就是 3 / 5000
p <- 3/5000
# 我們可以模擬1000次在10000個點擊下,方法A 的轉換數
plot(density(x <- rbinom(1000, 10000, p)))
# 估計超過我們觀測值的機率
mean(x > 10)
[1] 0.042
library(binom)
binom.confint(c(10, 3), c(10000, 5000), methods = "exact")
method x n mean lower upper
1 exact 10 10000 1e-03 0.0004796397 0.001838264
2 exact 3 5000 6e-04 0.0001237515 0.001752444
library(quantmod)
getSymbols("^TWII")
As of 0.4-0, 'getSymbols' uses env=parent.frame() and
auto.assign=TRUE by default.
This behavior will be phased out in 0.5-0 when the call will
default to use auto.assign=FALSE. getOption("getSymbols.env") and
getOptions("getSymbols.auto.assign") are now checked for alternate defaults
This message is shown once per session and may be disabled by setting
options("getSymbols.warning4.0"=FALSE). See ?getSymbols for more details.
[1] "TWII"
head(TWII)
TWII.Open TWII.High TWII.Low TWII.Close TWII.Volume
2007-01-02 7871.41 7937.26 7843.60 7920.80 5710600
2007-01-03 7954.96 7999.42 7917.30 7917.30 5951400
2007-01-04 7929.89 7955.90 7901.24 7934.51 5717400
2007-01-05 7940.20 7942.23 7821.71 7835.57 5181400
2007-01-08 7778.57 7797.57 7736.11 7736.71 4292400
2007-01-09 7778.38 7827.93 7778.38 7790.01 4516000
TWII.Adjusted
2007-01-02 7920.80
2007-01-03 7917.30
2007-01-04 7934.51
2007-01-05 7835.57
2007-01-08 7736.71
2007-01-09 7790.01
chartSeries(TWII, subset = "last 4 months", TA = c(addVo(), addBBands()))
library(Lahman)
head(Teams[,c("yearID", "name", "Rank", "W", "L", "R", "RA")])
yearID name Rank W L R RA
1 1871 Boston Red Stockings 3 20 10 401 303
2 1871 Chicago White Stockings 2 19 9 302 241
3 1871 Cleveland Forest Citys 8 10 19 249 341
4 1871 Fort Wayne Kekiongas 7 7 12 137 243
5 1871 New York Mutuals 5 16 17 302 313
6 1871 Philadelphia Athletics 1 21 7 376 266
totalRS <- Teams %>% select(yearID, R, G) %>%
mutate(AvgRperG = R/G) %>% group_by(yearID) %>% summarise(sum(AvgRperG))
names(totalRS) <- c("yearID", "RUN")
ggplot(data = totalRS, aes(x = yearID, y = RUN)) + stat_smooth() + geom_line()
geom_smooth: method="auto" and size of largest group is <1000, so using loess. Use 'method = x' to change the smoothing method.
head(filter(Pitching, playerID == "wangch01") %>% select(playerID, yearID, W, L, ERA))
playerID yearID W L ERA
1 wangch01 2005 8 5 4.02
2 wangch01 2006 19 6 3.63
3 wangch01 2007 19 7 3.70
4 wangch01 2008 8 2 4.07
5 wangch01 2009 1 6 9.64
6 wangch01 2011 4 3 4.04
suppressPackageStartupMessages({
library(jiebaR) # 斷詞利器
library(tm) # 文字詞彙矩陣運算
library(slam) # 稀疏矩陣運算
library(wordcloud) # 文字雲
library(topicmodels) # 主題模型
library(igraph) # 主題模型關聯
})
[1] 27
Warning in split.default(., rep(1:15, each = 30)): data length is not a
multiple of split variable
陳昇瑋 Sheng-Wei Chen 年會總召, 中央研究院
資訊科學研究所/ 研究員 陳昇瑋博士目前為中央研究院資訊科學
研究所研究員,同時是多媒體網路與系統實驗室主持人。他的研究焦
點著重在使用者滿意度、多媒體系統、社群計算及計算社會學等領域
,在多媒體系統及使用者經驗的量測及管理方面持續有代表性的研究
創見。 陳博士堅信資料及資料分析的價值,長期推廣資料科學及
其在各領域的應用,除本身研究皆基於資料來解決實際生活中的問題
,2014 年開始主辦「台灣資料科學愛好者年會」,期能將對於
資料科學的熱情傳達給大眾,一起來探索資料科學的潛力,將資料科
學引入每個人的專業領域之中。他十分期待能夠讓資料分析在台灣不
再是口號,而是大家手邊隨時可用來解決問題及創造價值的工具。
欲瞭解陳博士的研究及心得分享,請至他的個人網頁一探究竟。
Warning in split.default(., rep(1:15, each = 30)): data length is not a
multiple of split variable
陳 昇 瑋 Sheng Wei Chen 年會 總召 中央研
究院 資訊 科學 研究所 研究員 陳 昇 瑋 博士 目前 為
中央研究院 資訊 科學 研究所 研究員 同時 多媒體 網路
系統 實驗室 主持人 他 研究 焦點 著重 使用者 滿意度
多媒體系統 社群 計算 計算 社會學 領域 多媒體系統 使
用者 經驗 量 測及 管理方面 持續 有 代表性 研究 創見
陳博士 堅信 資料 資料 分析 價值 長期 推廣 資料 科
學 及其 各 領域 應用 除 本身 研究 皆 基於 資料 來
解決 實際 生活 中 問題 2014 年 開始 主辦 台
灣 資料 科學 愛好者 年會 期能將 對於 資料 科學 熱情
傳達 給大眾 一 起來 探索 資料 科學 潛力 將 資料
科學 引入 每個 人 專業 領域 之中 他 十分 期待 能夠
讓 資料 分析 台灣 不再 口號 而是 大家 手邊 隨時
可 用來 解決問題 創造 價值 工具 欲瞭解 陳博士 研究
心得 分享 請 至 他 個人 網頁 一探 究竟
| package | downloads | |
|---|---|---|
| 1 | Rcpp | 208576 |
| 2 | ggplot2 | 180109 |
| 3 | stringr | 168141 |
| 4 | stringi | 167537 |
| 5 | plyr | 166113 |
| 6 | digest | 156862 |
| 7 | magrittr | 156195 |
| 8 | scales | 152361 |
| 9 | reshape2 | 147689 |
| 10 | RColorBrewer | 138724 |
sudo sh -c 'echo "deb http://cran.csie.ntu.edu.tw/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt-get update && apt-get install -y r-base libcurl4-openssl-dev libxml2-dev
>"hello world" 後按下Enter,檢查螢幕輸出(記得加上引號)1 + 1 後按下Enter,檢查螢幕輸出,注意有無引號1 + 後按下Enter,檢查螢幕輸出,注意最左下角的開頭變成+>開頭me 之後按下Enterme 之後按下tabme 隻後按下Ctrl + Enter後,觀察命令列區me 後的位置,確認游標閃爍的位置在 me 之後,按下tablibrary(套件名稱)# 在命令列輸入:
install.packages('swirl', repos = 'http://taiwanrusergroup.github.io/R')
library(swirl)
swirl() # 括號很重要
swirl 這個函數的定義install_course_github("wush978", "DataScienceAndR", "course")
RBasic-01-Introduction之外,每個作業最後都要編輯一個檔案。
RBasic-02-HW.RRBasic-03-HW.RRBasic-04-HW.RRBasic-05-HW.RRBasic-06-HW.RRBasic-07-HW.R<學號>.zip的檔案上傳到ceiba。該壓縮檔的內容應該為:d01921016/
d01921016/RBasic-02-HW.R
d01921016/RBasic-03-HW.R
d01921016/RBasic-04-HW.R
d01921016/RBasic-05-HW.R
d01921016/RBasic-06-HW.R
d01921016/RBasic-07-HW.R
submit()檢查是否有錯sessionInfo()的輸出結果