> theUrl <- "http://www.jaredlander.com/data/Tomato%20First.csv" # 讀取檔案的完整路徑(在此為網路位址)
> tomato <- read.table (file = theUrl, header = TRUE, sep = ",") # 將檔案載入R,在這裡設定
>
> head(tomato) # 查看檔案的第一部分
Round Tomato Price Source Sweet Acid Color Texture Overall Avg.of.Totals Total.of.Avg
1 1 Simpson SM 3.99 Whole Foods 2.8 2.8 3.7 3.4 3.4 16.1 16.1
2 1 Tuttorosso (blue) 2.99 Pioneer 3.3 2.8 3.4 3.0 2.9 15.3 15.3
3 1 Tuttorosso (green) 0.99 Pioneer 2.8 2.6 3.3 2.8 2.9 14.3 14.3
4 1 La Fede SM DOP 3.99 Shop Rite 2.6 2.8 3.0 2.3 2.8 13.4 13.4
5 2 Cento SM DOP 5.49 D Agostino 3.3 3.1 2.9 2.8 3.1 14.4 15.2
6 2 Cento Organic 4.99 D Agostino 3.2 2.9 2.9 3.1 2.9 15.5 15.1
整理自 R 軟體資料分析基礎與應用 -- Ch06 : 讀取各類資料
(一)讀取 CSV
> theUrl <- "http://www.jaredlander.com/data/Tomato%20First.csv" # 讀取檔案的完整路徑(在此為網路位址)
> tomato <- read.table (file = theUrl, header = TRUE, sep = ",") # 將檔案載入R,在這裡設定
>
> head(tomato) # 查看檔案的第一部分
Round Tomato Price Source Sweet Acid Color Texture Overall Avg.of.Totals Total.of.Avg
1 1 Simpson SM 3.99 Whole Foods 2.8 2.8 3.7 3.4 3.4 16.1 16.1
2 1 Tuttorosso (blue) 2.99 Pioneer 3.3 2.8 3.4 3.0 2.9 15.3 15.3
3 1 Tuttorosso (green) 0.99 Pioneer 2.8 2.6 3.3 2.8 2.9 14.3 14.3
4 1 La Fede SM DOP 3.99 Shop Rite 2.6 2.8 3.0 2.3 2.8 13.4 13.4
5 2 Cento SM DOP 5.49 D Agostino 3.3 3.1 2.9 2.8 3.1 14.4 15.2
6 2 Cento Organic 4.99 D Agostino 3.2 2.9 2.9 3.1 2.9 15.5 15.1
>