Reputation: 11
x <- del_time[,c('arrivaltime')][1:4]
x
y <- del_time[,c('prop_arrdelay')][1:4]
y
barplot(x,y)
Here are the results
[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
I am getting an error here, how can I fix it?
Upvotes: 0
Views: 30
Reputation: 76651
The solution is to use the formula interface to barplot
.
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)
Upvotes: 1