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)