Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何从数据集中绘制图形? x条形图(x,y) -0.01*高度中出错:二进制运算符的非数字参数_R_Plot - Fatal编程技术网

R 如何从数据集中绘制图形? x条形图(x,y) -0.01*高度中出错:二进制运算符的非数字参数

R 如何从数据集中绘制图形? x条形图(x,y) -0.01*高度中出错:二进制运算符的非数字参数,r,plot,R,Plot,我在这里遇到了一个错误,我如何修复它 解决方案是使用公式界面来条形图 [1] "Early" "Evening" "Morning" "Night" > y <- del_time[,c('prop_arrdelay')][1:4] > y [1] 0.9083699 0.4830701 0.3752655 0.5393416 > barplot(x,y) Error in -0.01 * height : non-numeric argument to bina

我在这里遇到了一个错误,我如何修复它

解决方案是使用公式界面来
条形图

[1] "Early"   "Evening" "Morning" "Night"  
> y <- del_time[,c('prop_arrdelay')][1:4]
> y
[1] 0.9083699 0.4830701 0.3752655 0.5393416
> barplot(x,y)
Error in -0.01 * height : non-numeric argument to binary operator

x您在不需要的情况下调用函数
c()
两次,
c('arrivaltime')
'arrivaltime'
是同一个向量。当您有2个或更多矢量元素时,您只需要组合函数
c()
。由于图形大于轴,如何增加y的范围?@loms使用
ylim=c(0,1)
[1] "Early"   "Evening" "Morning" "Night"  
> y <- del_time[,c('prop_arrdelay')][1:4]
> y
[1] 0.9083699 0.4830701 0.3752655 0.5393416
> barplot(x,y)
Error in -0.01 * height : non-numeric argument to binary operator
x <- c("Early",   "Evening", "Morning", "Night"  )
y <- c(0.9083699, 0.4830701, 0.3752655, 0.5393416)

barplot(y ~ x, ylim = c(0, 1), las = 2)