R 使用ggplot在同一列中绘制向量

R 使用ggplot在同一列中绘制向量,r,R,我有一个向量: a<-runif(100) a<-runif(100) x<-rep(1,times=length(a)) # x & a same length plot(x,a,type="p") #type = "p" : point 但它给了我错误 Error in barplot.default(x = 1, a) : argument 1 matches multiple formal arguments 我

我有一个向量:

a<-runif(100)
a<-runif(100)
x<-rep(1,times=length(a))       # x & a same length
plot(x,a,type="p")              #type = "p" : point
但它给了我错误

Error in barplot.default(x = 1, a) : 
  argument 1 matches multiple formal arguments
我做错了什么?

使用plot()而不是barplot(),并将x值转换为向量:

a<-runif(100)
a<-runif(100)
x<-rep(1,times=length(a))       # x & a same length
plot(x,a,type="p")              #type = "p" : point

如果我使用的是ggplot呢?很抱歉,我没有指定更新以显示来自ggplot2的qplot(0和ggplot()调用