2015-03-25 71 views
1

我只是想讀取一個CSV文件使用R和創建一個使用ggplot scatterplot。我以前這樣做,使用不同的文件時沒有問題,但這當前一個是給我的問題錯誤:意外','在'ggplot(dat在R

我做的是輸入以下命令:

dat<-read.csv("IV.csv") 
head(dat) 
    a  b 
1 -80.2502 -1.24274 
2 -80.2034 -1.27208 
3 -80.1567 -1.06815 
4 -80.1100 -1.33416 
5 -80.0165 -1.67727 
6 -79.9698 -1.32458 

ggplot(dat, aes=(x=a,y=b)) + geom_point(shape=1) 
Error: unexpected ',' in "ggplot(dat, aes=(x=a," 

這是怎麼回事

+1

嘗試沒有'='緊跟'aes'。 – LJW 2015-03-25 01:26:12

+1

就是這樣。 aes()不aes =() – rivimey 2015-03-25 01:26:56

+0

謝謝,我多麼愚蠢 – user4352158 2015-03-25 01:29:32

回答

6

你有一個語法錯誤:

[R從

ggplot(dat, aes=(x=a,y=b)) + geom_point(shape=1) 

EMOVE後aes

=標誌

ggplot(dat, aes(x=a,y=b)) + geom_point(shape=1) 
+2

已經在評論中回答。 – 2015-03-25 01:42:50