0
所以我做了一些數據的readtable -R線 'M' 沒有 'N' elems的在讀出表
salaries.data = read.table(someUrl, header=FALSE, sep=' ', na.strings="?", comment.char='')
plot(salaries.data)
我得到這個錯誤 -
## Error: line 2 did not have 22 elements
這是什麼數據看起來,當我打印在RStudio的控制檯像
V1
1 Y X1 X2 X3
2 33.2 3.5 9.0 6.1
3 40.3 5.3 20.0 6.4
4 38.7 5.1 18.0 7.4
5 46.8 5.8 33.0 6.7
6 41.4 4.2 31.0 7.5
7 37.5 6.0 13.0 5.9
8 39.0 6.8 25.0 6.0
9 40.7 5.5 30.0 4.0
10 30.1 3.1 5.0 5.8
11 52.9 7.2 47.0 8.3
12 38.2 4.5 25.0 5.0
13 31.8 4.9 11.0 6.4
14 43.3 8.0 23.0 7.6
15 44.1 6.5 35.0 7.0
16 42.8 6.6 39.0 5.0
17 33.6 3.7 21.0 4.4
18 34.2 6.2 7.0 5.5
19 48.0 7.0 40.0 7.0
20 38.0 4.0 35.0 6.0
21 35.9 4.5 23.0 3.5
22 40.4 5.9 33.0 4.9
23 36.8 5.6 27.0 4.3
24 45.2 4.8 34.0 8.0
25 35.1 3.9 15.0 5.0
此表看起來中規中矩 - 所以這是怎麼回事?
除了它沒有很好地形成。什麼是V1?你有沒有表頭? –
當我訪問網址時,V1不在表格中我得到它...所以我不確定那裏是怎麼回事?我可以強迫R跳過那條線嗎? – praks5432
什麼'someUrl'?這裏的數據看起來像格式良好:'salaries.data = read.table(「http://sites.stat.psu.edu/~lsimon/stat501/sp04/data/mathsalaries.txt」,header = TRUE,sep =「\ t」)' – lukeA