dta <- read.table("student2017.txt",header = T)
newID <-"U76067010"
# 避免加入的資料類型有差異,將ID轉為字元
dta$ID <- as.character(dta$ID)
dtaNew <- data.frame(c(dta[1:13,],newID,dta[14:16,]))
# 檔案ID整理,以免ID跑掉
names(dtaNew) <- "ID";dtaNew
## ID
## 1 D84057058
## 2 C44035023
## 3 D84041162
## 4 D84046081
## 5 D84021057
## 6 U36037025
## 7 U36041074
## 8 U36041090
## 9 U36051087
## 10 U36031118
## 11 U36041082
## 12 U76051019
## 13 U76054025
## 14 U76067010
## 15 U76064062
## 16 U76041064
## 17 U76041080
#單純以plot(women)進行
dta <- women
head(dta)
## height weight
## 1 58 115
## 2 59 117
## 3 60 120
## 4 61 123
## 5 62 126
## 6 63 129
class(dta)
## [1] "data.frame"
plot(women)
#透過錯誤修改進行後結果無法呈現,但會出現warnings
data.entry(dta)
head(dta)
## $height
## [1] 50 59 60 61 62 63 64 65 66 67 68 69 70 71 72
##
## $weight
## [1] 115 117 120 123 126 129 132 135 139 142 146 150 154 159 164
class(dta)
## [1] "list"
# 下載檔案
fL <- "http://www.rdatamining.com/data/titanic.raw.rdata?attredirects=0"
fD <- "~/DM-R/titanic.raw.rdata"
download.file(fL, destfile = fD,mode = "wb")
load("C:/Users/USER/Documents/DM-R/titanic.raw.rdata")
head(titanic.raw)
## Class Sex Age Survived
## 1 3rd Male Child No
## 2 3rd Male Child No
## 3 3rd Male Child No
## 4 3rd Male Child No
## 5 3rd Male Child No
## 6 3rd Male Child No
pacman::p_load(scholar)
dta <- get_citation_history('fCNw-4kAAAAJ')
plot(dta, xlab = "Year", ylab = "Citations", type = "h",
lwd = 2, xlim = c(2008, 2018), ylim = c(0, 500))
grid()
## THE END