[Solved] How to plot histogram in R?


I guess you need a barplot:

x <- data.frame(n_vehicles = c(10, 20, 30, 40),
                time_interval = c(2, 5, 4, 9))
barplot(height = x$time_interval,
        names.arg = x$n_vehicles)

enter image description here

Or alternatively:

plot(x = x$n_vehicles,
     y = x$time_interval,
     type = "h")

The "h" stands for “histogram”.

1

solved How to plot histogram in R?