#輸入資料
##一、csv檔,Import Dataset
##二、讀取純文字檔(可以從複製pdf上的表格貼上記事本,存成.txt檔,然後用read.table開啟,如果資料內有中文,一定要加上fileEncoding = "UTF-8")
###read.table("file.txt", header = TRUE, stringsAsFactors = FALSE, fileEncoding = "UTF-8")
##三、從鍵盤上直接輸入資料(在Consol輸入資料,每筆資料以空白鍵或enter鍵區隔,連按兩次enter鍵結束輸入)
#1. 從鍵盤上直接輸入數字資料
x <- scan()
#2.從鍵盤上直接輸入文字資料
y<- scan(what="character")
#3.#從鍵盤上直接輸入數字資料, 並存成data.frame格式
#輸入name和sex資料(文字)
df<-data.frame(name=scan(what="c"), sex=scan(what="c"))
#輸入height和weight資料(數字)
df1<-data.frame(height=scan(), weight=scan())