Giter Club home page Giter Club logo

datascienceandr's Issues

Vector Section (81%)

建議在此題目前 複習一下向量的names(我擔心忘記的人 看你的說明會看不懂)

| 在剛剛attributes(g)的輸出中,同學應該會看到一個帶有名字的list。所有物件的attributes都是帶有名字的list。
| 一個有趣的事情是,通常向量的名字,就是存放在"names"這個attributes的character向量。在R 中,我們可以用attr(g, | "names") 來取得名字是"names"的屬性。請同學試試看。

chapter 6 RBasic-06-List-DataFrame -- 建議

(1)21% 修改多餘的字與錯字
因為list是個向量,所以我們過去學過得[]還是可以使用的。但是子向量的型態要和原本的向量相同,
所以如果我們運用如:x[3]的指令,從x 中選出只有包含第二個元素的向量,得到的輸出就會和x一樣是一個list。
--->
因為list是向量,所以我們過去學過的[ ]還能使用。所以如果我們運用 x[3] ,則從x 中選出第"三"個元素,得到的輸出就會和x一樣是一個list。簡言之, class(x[1])class(x[2])class(x[3]) 的結果都會是 list ,而 class(x[[1]])class(x[[2]])class(x[[3]]) 的結果則取決於原先生成 data.frame的資料型態; 請同學試試看:mode(x[3])

(2) 44% 刪除: "具體來說,data.frame就是一個表格" ,將其內容移至47%並新增說明文字

(3)47% 新增以下文字:
具體來說,data.frame就是一張"二維"表格,且只要求同一欄中(colunms)資料型態相同即可; 又或者我們可以把 data.frame 當成是 list 的特例(子集合),以利於我們後續資料整處理與連接資料庫。

(4)65% 更改舉例:
將原本的 a <- data.frame(class = 1, id = 1:10)可替換為
a <- data.frame(class = "NTU", id = 1:10,scores = matrix(c(80:99),nrow=10,ncol=2 ) )
理由:(a)多一個文字型態
(b) scores 證明可放入 matrix
R 會自動幫忙把 scores 拆成 scores.1、scores.2(如下),但實務上似乎比較少這樣做?
(至少我沒遇過)
class id scores.1 scores.2
1 NTU 1 80 90
2 NTU 2 81 91
3 NTU 3 82 92
4 NTU 4 83 93
5 NTU 5 84 94
6 NTU 6 85 95
7 NTU 7 86 96
8 NTU 8 87 97
9 NTU 9 88 98
10 NTU 10 89 99

(4)
其餘 "在windows上,如果名字是中文時,使用$的語法可能會出錯" →
口頭鼓勵同學們儘量一般英文變數的命名慣例,以利未來將資料匯出至資料庫(例:sqlite … )

Vector Section List(27%)

Vector的題目
g = lm(formula = dist ~ speed, data = cars)

我不太懂 以下的狀況(我猜這是我對lm 在list型態呈現不熟的關係)

g[1]
$coefficients
(Intercept) speed
-17.579095 3.932409

g[2]
$residuals
1 2 3 4 5 6 7 8 9 10
3.849460 11.849460 -5.947766 12.052234 2.119825 -7.812584 -3.744993 4.255007 12.255007 -8.677401
11 12 13 14 15 16 17 18 19 20
2.322599 -15.609810 -9.609810 -5.609810 -1.609810 -7.542219 0.457781 0.457781 12.457781 -11.474628
21 22 23 24 25 26 27 28 29 30
-1.474628 22.525372 42.525372 -21.407036 -15.407036 12.592964 -13.339445 -5.339445 -17.271854 -9.271854
31 32 33 34 35 36 37 38 39 40
0.728146 -11.204263 2.795737 22.795737 30.795737 -21.136672 -11.136672 10.863328 -29.069080 -13.069080
41 42 43 44 45 46 47 48 49 50
-9.069080 -5.069080 2.930920 -2.933898 -18.866307 -6.798715 15.201285 16.201285 43.201285 4.268876

g[3]
$effects
(Intercept) speed

-303.9144946 145.5522550 -8.1154395 9.8845605 0.1941147 -9.4963311 -5.1867770 2.8132230
10.8132230 -9.8772228 1.1227772 -16.5676686 -10.5676686 -6.5676686 -2.5676686 -8.2581144

-0.2581144 -0.2581144 11.7418856 -11.9485602 -1.9485602 22.0514398 42.0514398 -21.6390061

-15.6390061 12.3609939 -13.3294519 -5.3294519 -17.0198977 -9.0198977 0.9801023 -10.7103435

3.2896565 23.2896565 31.2896565 -20.4007893 -10.4007893 11.5992107 -28.0912352 -12.0912352

-8.0912352 -4.0912352 3.9087648 -1.4721268 -17.1625726 -4.8530184 17.1469816 18.1469816

45.1469816 6.4565358

g[4]
$rank
[1] 2

g[5]
$fitted.values
1 2 3 4 5 6 7 8 9 10 11
-1.849460 -1.849460 9.947766 9.947766 13.880175 17.812584 21.744993 21.744993 21.744993 25.677401 25.677401
12 13 14 15 16 17 18 19 20 21 22
29.609810 29.609810 29.609810 29.609810 33.542219 33.542219 33.542219 33.542219 37.474628 37.474628 37.474628
23 24 25 26 27 28 29 30 31 32 33
37.474628 41.407036 41.407036 41.407036 45.339445 45.339445 49.271854 49.271854 49.271854 53.204263 53.204263
34 35 36 37 38 39 40 41 42 43 44
53.204263 53.204263 57.136672 57.136672 57.136672 61.069080 61.069080 61.069080 61.069080 61.069080 68.933898
45 46 47 48 49 50
72.866307 76.798715 76.798715 76.798715 76.798715 80.731124

''perl is deprecated. Please use regexp instead". Please help to fix!

/> install_course_github("wush978", "DataScienceAndR", "course")
perl is deprecated. Please use regexp instead
Warning message:
In file.rename(file.path(system.file(package = "swirl"), "Courses", :
cannot rename file '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/swirl/Courses/wush978-DataScienceAndR-aa661ec' to '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/swirl/Courses/DataScienceAndR', reason 'Directory not empty'

/> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.1 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] curl_0.9.1 swirl_2.2.21

loaded via a namespace (and not attached):
[1] httr_1.0.0 R6_2.1.0 magrittr_1.5 tools_3.2.2 RCurl_1.95-4.7 yaml_2.1.13 memoise_0.2.1 crayon_1.3.1 stringi_0.5-5 stringr_1.0.0
[11] digest_0.6.8 testthat_0.10.0 bitops_1.0-6

no package called ‘curl’

在windows測試的結果:
要load youbike資料時(rs <- dataSetMetadataSearch(q ="youbike"))
會出現Error in loadNamespace(name) : there is no package called ‘curl’
須先用下面指令
install.packages(c('devtools','curl'))
才能繼續

Linux Mint 系統問題

我的 Linux Mint 15 有系統問題無法安裝R
我照這一頁的安裝指令輸入:http://cran.csie.ntu.edu.tw/bin/linux/debian/

主要是在這一個指令發生問題:apt-get install r-base r-base-dev
錯誤訊息是 404 Not Found [IP: 91.189.92.200 80]

他好像要我改好正確的 /etc/apt/sources.list 和改好正確的 mirror
但我不懂要怎麼改,我試了一些網路上的教學但也失敗了

直接使用這一行也失敗了:deb /bin/linux/debian wheezy-cran3/
不太清楚正確的 deb 的 /etc/apt/sources.list 應該怎麼改

有些教學好像是說作業系統沒有更新到最新版的問題
好像有說我的系統要先更新再來試著安裝,但是我輸入
apt-get update 大部份成功,少數失敗,並顯示:
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring-updates/universe/binary-i386/Packages 404 Not Found [IP: 91.189.91.15 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
apt-get upgrade 失敗,並顯示:
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

問的不是swirl自學程式的問題,但我的 R 灌不起來,所以PO在這裡問
感謝!

Vector Section (86%)

粗體字的部分我看不懂

| 另一個attributes(g)的輸出,是一個名字是"class"的character向量。 它的值是"lm"。請同學試試看:attr(g, "class")

斷句跟敘述不明

| 而help(chol2inv就是一個無效的expression,因為少了一個)

=>
help(chol2inv
少了一個)是無效的expression
請完整的輸入help(chol2inv)

沒有解釋何謂expression

此題目中 未解釋何謂是expression(前幾題也沒解釋)
建議在此題前面加上assignment 跟 expression的解釋
以方便學員了解跟作答

| 在R
| 中,c()可以接受任意數量的的向量參數,並且會依照順序把它們
| 串接成一個單一向量。舉例來說:c(x, | 1)會在剛剛我們建立的x 後面 再接一個1
| 。而c(x, 2, 3)則會在x 之後接上2 和3
| 。請同學依照這個要領,
| 撰寫一個expression,內容是建立一個在x
| 後面接上x 的向量。

第三章 向量長度更改 錯誤訊息

| 我們可以更改一個向量的長度。舉例來說,現在x 是一個長度是5
| 、型態是numeric的向量。我們可以利用:length(x) <- 10 把x 的長度改成10。請同學試試看。

得到錯誤訊息:
warning messages from top-level task callback 'mini'
Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
NAs introduced by coercion

然後課程就卡住無法進行了

有關orglist-100.csv

我試著用readLines(file(orglist.path, encoding = "utf-16le"), n=3)開檔,結果出現:

[1] ""機關代碼","機關名稱","郵遞區號","機關地址","機關電話","主管機關代碼","主管機關名稱","傳真","機關生效日期","機關裁撤日期","機關層"
Warning message:
In readLines(file(orglist.path, encoding = "utf-16le"), n = 3) :
incomplete final line found on 'C:\Users\Allen\Documents\R\win-library\3.2\swirl\Courses\DataScienceAndR\RBasic-07-Loading-Dataset\orglist-100.CSV'

使用readBin看BOM是ff fe,因此編碼應該是用utf-16le,但是從上面的結果可以看出讀檔並不完整。

因為不知道是不是編碼的問題,我還試過utf-8, big5, utf-16be, utf-32le, utf-32be,都不會出現有意義的文字。只有utf-16le, ucs-2le會出現上述的結果。不曉得是不是我漏考慮了什麼?

斷句很奇怪~~

比如以下題目 斷句會影響對文字的了解
建議整理斷句

| 在R
| 中,c()可以接受任意數量的的向量參數,並且會依照順序把它們
| 串接成一個單一向量。舉例來說:c(x, | 1)會在剛剛我們建立的x 後面 再接一個1
| 。而c(x, 2, 3)則會在x 之後接上2 和3
| 。請同學依照這個要領,
| 撰寫一個expression,內容是建立一個在x
| 後面接上x 的向量。

題意不明

取消此issueXD(但我不知道怎麼delet it)

DF 12%建議冒號改逗號

請同學建立一個list:x <- list(iris = iris, cars = cars, n = 2) =>list, x <- list(iris = iris, cars = cars, n = 2)

| 舉例來說,請同學建立一個list:x <- list(iris = iris, cars = cars, n = 2) 這裡iris = | iris的意思是說,第一個元素的名字是"iris",而值會是變數iris的值。

small tipo

作業六最後的部分

' 請找出一個名字,answer12,讓g[[answer12]]就是R-squared

這一行應該改成

' 請找出一個名字,answer12,讓g.s[[answer12]]就是R-squared

' 你可以參考help(summary.lm)裡面的說明。

answer12 <- "r.squared"

Ambiguous Description about hw2

第二章作業的部分
最後,請同學找出「社會服務業的用電量超過製造業10%的年度」
正確答案是
year1.answer2 <- year1[power1>0.1_power2]
有可能會誤會是以製造業電量當基準超過1.1倍
year1.answer2 <- year1[power1>1.1_power2]
的不過這影響應該不大

DF 3%錯字

汎用=>泛用

| R 的list是非常汎用的物件,相信同學在前面的課程也已經有簡單操作R 裡面的迴歸模型,
| 而這些迴歸模型的底層架構,就是用list所建立的。

Default Answer is wrong

| 另外我們也跟各位介紹一個更范用產生向量的方式:seq
| seq(1, 10) 在R
| 中,其實就是1:10。請試試看輸入seq(1:10)

Your default answer is seq(1,10)

Please correct it

統一版本號到1.0

方便起見,需要定義課程內容的版本號

10/20當天所有版本號為1.0

設計作業

RBasic-01 ~ RBasic-07需要在最後設計一個script類型的作業,讓同學上傳做批改

chap7 RBasic-07-Loading-Dataset 建議

(1)29% 與 80% 在 WIN10 與 LINUX(Docker) 都會出現疑似Bug的警告訊息,但不影響後續作答;

29% 警告訊息:
warning messages from top-level task callback 'mini'
Warning message:
In stri_c(..., sep = sep, collapse = collapse, ignore_null = TRUE) :
longer object length is not a multiple of shorter object length

80% 警告訊息:
warning messages from top-level task callback 'mini'
Warning messages:
1: closing unused connection 11 (/usr/local/lib/R/site-library/swirl/Courses/DataScienceAndR/RBasic-07-Loading-Dataset/A_LVR_LAND_A.CSV)
2: closing unused connection 9 (/usr/local/lib/R/site-library/swirl/Courses/DataScienceAndR/RBasic-07-Loading-Dataset/A_LVR_LAND_A.CSV)
3: closing unused connection 7 (/usr/local/lib/R/site-library/swirl/Courses/DataScienceAndR/RBasic-07-Loading-Dataset/A_LVR_LAND_A.CSV)

(2) 20%說明文字調整

原文:
| 這就是data這個函數的功能。它可以讓同學從套件載入一個
| 資料集,並且會指定到第一個參數的變數名稱。舉例來說,在輸入: data(iris, package = "datasets"),R
| 會把一個名為iris的資料 集輸入到iris這個變數之中。

建議:
| 這就是data函數的功能,它可以讓同學從套件載入特定資料集(Data Sets)。
| 舉例來說,我們剛才已由library(help=datasets)觀察到 datasets套件中有包含許多資料集,
| 例如:AirPassengers、BJsales、…、iris…等
| 我們可用 data(iris, package = "datasets")指令,其中第一個參數可指定特定資料集,
| 則R會把iris的資料集輸入到iris這個變數之中。

(3) 40% 建議
原文 :
| csv 檔的格式是以列為單位。每一行檔案就是一列。而每一列中,
| 是以一個分隔符號來讓使用者或程式分辨欄位。常見的分隔符號有: tab (\t)或逗號(,) 。

建議:
| csv 檔的格式是以Line為單位。每一Line就是一筆紀錄(Record)。而每一筆紀錄中,
| 是以一個分隔符號來讓使用者或程式分辨欄位。常見的分隔符號有: tab (\t)或逗號(,) 。
| 若以逗號做為分隔符號,則學生姓名加上4次小考分數的一筆紀錄,可用CSV表達如下:
| 柯小哲,77,82,87,92

說明:
"行" 這個中文字很討厭,可以是 line 或是 row;
所以"每一行檔案就是一列",這樣的說明文字,第一次看會覺得很迷惑??!!
所以我自己於管理學院講資料庫概論時,我是直接用 row、columns、"欄位"、"紀錄"於課堂進行教學,
而避用中文的"行"、"列"。
另外中國的行列譯法剛好與我們相反,故建議直接用英文指稱,而非假裝 ABC;

typo

The italic and bold words are typo.
| 不是所有的運算都是向量式的。如果給定一個向量x
| , max(x)會傳回x
| 中_最小_的值,而min(x)會傳回x 最大 的值。


| 另外我們也跟各位介紹一個更_范用_產生向量的方式:seq
范用=>泛用
| seq(1, 10) 在R
| 中,其實就是1:10。請試試看輸入seq(1:10)

作業的中文編碼問題

作業的原始碼是UTF-8,經過測試在windows上的顯示有編碼問題。

Rstudio 可以透過 reopen with encoding... 解決

敘述看不懂

在 RBasic-03-Data-Structure-Object 中,這段敘述怪怪的,看不懂。

| 這裡再解釋一次g[1]g[[1]]的差異。使用g[1]時,使用者一個第一個值和g[[1]]一樣的list。
| 使用g[[1]],使用者會取出第一個值,所以g[[1]]的型態就是g的第一個值的型態不同。
| 所以在上數的例子中,g[1]的型態是list,而g[[1]]的型態就是numeric。

第三章 list 命名 "coefficient"

| 另一個我們需要知道的事情,就是list可以有名字。舉例來說,我們除了用g[[1]]來取得第一個值之外,也可以用
| g[["coefficients"]]來取得第一個值。因為g這個向量是有名字的,而第一個名字就是"coefficients"。請同學試試看。

改寫成:可以為list命名。

| 適當的使用名字,可以讓程式碼更有可讀性。舉例來說,如果我們知道g就是一個迴歸模型,我們也知道迴歸模型通常
| 就是一個參數向量,那我們就會預期:g[["coefficients"]]就是這個迴歸模型的參數。(在統計學課本中,迴歸模型的參數
| 通常稱作:"coefficients"。

改寫成:適當的命名,可以讓程式碼更易讀
另外應該是所有統計模型的參數都叫做 coefficient 吧 ^^"

RBasic-00 目前長期失效

自從某日開始,RBasic-00就失效至今。

可能需要尋找新的範例資料集,以及把RBasic-00從課程清單中先移除。

How to browse homework w/ R or RStudio ?

Sorry about the skip of Data Science class of NTU last week, it seems I miss sth important.
I've seen the slides, and install R and RStudio(Mac OS X EI), and swirl and install class goes well.
screen shot 2015-10-25 at 1 07 15 pm
But how can I see the content of class and homework? Is it in RStudio ?

DF 79%解釋不清

建議寫法:
a[2,"id"] 可以選到第二列第二欄
因為 a[2,]代表第二列
a[,"id"] id在第二欄

所以 其交集為第二列第二欄

| 欄位的方向,也可以用名字代替。舉例來說,a[2,"id"]會選出名稱為"id",也就是第二欄的第二個元素。
| 以表格的觀點來看,就是第2 列第2 欄。請同學試試看。

Error on Lesson Menu - 1: appveyor.yml

"appveyor.yml" is supposedly not for students so that it would be confused when it appears in the lesson menu. Otherwise,when users select 1: appveyor.yml in lesson menu, it leads to an error," Error in file(con, "r") : invalid 'description' argument| Leaving swirl now. Type swirl() to resume."

Thus, I suggest to remove "1: appveyor.yml" from lesson menu.

Ning

RBasic-07-Loading-Dataset系統找不到指定的路徑

在選單下選擇8.RBasic-07-Loading-Dataset出現以下錯誤:
Error in normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:/Users/Allen/Documents/R/win-library/3.2/swirl/Courses/DataScienceAndR/RBasic-07-Loading-Dataset/A_LVR_LAND_A.CSV": 系統找不到指定的路徑。

factor 52% 敘述可以更精簡~~

| str印出的敘述表示,這個Factor向量有四個levels,並列出levels對應的名稱。
| 在levels名稱之後接著一串整數,Factor實際上就是以這些整數代表對應的levels名稱。
| 例如:一開始的3代表第三個level「B」,接著的1代表第一個level「A」。
| (你可以對照Rstudio右上角Environment中blood_type和
| blood_type_factor)

Cannot load youbike dataset

| 接著,請同學輸入:rs <- | dataSetMetadataSearch(q = "youbike")來:
| 1. 搜尋youbike的資料源;2.
| 將結果儲存到變數rs之中

rs<-dataSetMetadataSearch(q = "youbike")
Error in curl::curl_fetch_memory(url, handle = handle) :
Failure when receiving data from the peer
rs=dataSetMetadataSearch(q = "youbike")
Error in curl::curl_fetch_memory(url, handle = handle) :
Failure when receiving data from the peer

I am stuck after typing skip(). It shows unstopped "download red light"

chap. 7 作業部分出現錯誤訊息

warning messages from top-level task callback 'mini'
Warning message:
closing unused connection 4 (/Library/Frameworks/R.framework/Versions/3.1/Resources/library/swirl/Courses/DataScienceAndR/RBasic-07-Loading-Dataset/A_LVR_LAND_A.CSV)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.