错误:“ggplot中的意外','”(R中的数据)

时间:2015-03-25 01:21:59

标签: r ggplot2

我只是尝试使用R读取CSV文件并使用ggplot创建散点图。我在使用不同的文件之前没有遇到任何问题,但是这个当前的问题给我带来了问题

我正在做的就是输入以下命令:

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 个答案:

答案 0 :(得分:7)

您遇到语法错误:

=

之后移除aes符号

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

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