檔案處理
fL <- paste0("http://", IDPW, "140.116.183.121/~sheu/dataM/Data/Subject1.zip")
download.file(fL, "Subject1.zip", mode = "wb")
unzip("Subject1.zip")
fLs <- paste0("Subject1/", 1:4, sep = "w.dat")
整理與名稱調整
dta <- lapply(fLs, read.table, header = TRUE, skip = 1, sep = "\t") %>%
rbindlist %>%
select(-X)
names(dta) <- gsub("X......", "", names(dta))
names(dta) <- gsub("[.]", "", names(dta))
繪圖
new_dta <- dta %>% mutate(ID = 1:1804) %>%
gather(key = "Attribute", value = "score", 1:30) %>%
mutate(Attribute_f = as.factor(Attribute))
## Warning: package 'bindrcpp' was built under R version 3.4.3
#
ggplot(new_dta, aes(Attribute_f, score))+
geom_boxplot()+
labs(x = "區塊", y = "時間")
