错误:ggplot(R中的dat)中出现意外的“,”字符

错误:ggplot(R中的dat)中出现意外的“,”字符,r,ggplot2,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.

我只是想用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,"

发生了什么事?

您有一个语法错误:

删除aes后的=符号


试一下,不要在aes后面紧跟着=就是这样。aes not aes=谢谢,meAlready在评论中的回答是多么愚蠢。
ggplot(dat, aes=(x=a,y=b)) + geom_point(shape=1)
ggplot(dat, aes(x=a,y=b)) + geom_point(shape=1)