View source: R/core_queuefunctions.R
| queue | R Documentation |
queue is a faster version of queue_step but the input returned is much simpler. It is not compatible with the summary.queue_list method or the plot.queue_list method.
queue(arrivals, service, servers = 1, serveroutput = FALSE)
arrivals |
numeric vector of non-negative arrival times |
service |
numeric vector of non-negative service times |
servers |
a non-zero natural number, an object of class |
serveroutput |
boolean whether the server used by each customer should be returned. |
If the arrival vector is out of order the function will reorder it. The same reordering will be applied to the service vector, this is so each customer keeps their service time. Once the queue is computed the original order is put back.
queue_step
n <- 1e2
arrivals <- cumsum(rexp(n, 1.8))
service <- rexp(n)
departures <- queue(
arrivals, service, servers = 2)
head(departures)
curve(ecdf(departures)(x) * n,
from = 0, to = max(departures),
xlab = "Time", ylab = "Number of customers")
curve(ecdf(arrivals)(x) * n,
from = 0, to = max(departures),
col = "red", add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.