简体   繁体   中英

How can I graph from the data set?

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?

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)

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM