Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to count the number of concurrent users using time interval data?
    primarykey
    data
    text
    <p>I have a data set representing data from a log file which shows users and machine taking a connection for a server. I have a connection start time (variable start) and end time (variable end) in the dataset:</p> <pre><code>tdata &lt;- structure(list(username = structure(c(9L, 6L, 7L, 5L, 3L, 2L, 4L, 8L, 1L, 4L), .Label = c("ESSAA", "HBRTE", "HPAIUS", "KOLA", "MAITAEN", "MARKEA", "MIAINN", "MSALA", "PAREDT"), class = "factor"), machine = structure(c(3L, 2L, 4L, 8L, 1L, 5L, 9L, 6L, 7L, 9L), .Label = c("D5785.domain.com", "D5874.domain.com", "D5927.domain.com", "D6000.domain.com", "D6092.domain.com", "D6147.domain.com", "D6142.domain.com", "D6169.domain.com", "D6194.domain.com"), class = "factor"), start = structure(c(1322672567, 1322687984, 1322465646, 1322696883, 1322695042, 1322697073, 1322697547, 1322692794, 1322697694, 1322700934), tzone = "", class = c("POSIXct", "POSIXt")), end = structure(c(1322693766, 1322695797, 1322696945, 1322697004, 1322697284, 1322697303, 1322697781, 1322700307, 1322700667, 1322701224), tzone = "", class = c("POSIXct", "POSIXt"))), .Names = c("username", "machine", "start", "end"), row.names = c(NA, 10L), class = "data.frame") &gt; tdata username machine start end 1 PAREDT D5927.domain.com 2011-11-30 19:02:47 2011-12-01 00:56:06 2 MARKEA D5874.domain.com 2011-11-30 23:19:44 2011-12-01 01:29:57 3 MIAINN D6000.domain.com 2011-11-28 09:34:06 2011-12-01 01:49:05 4 MAITAEN D6169.domain.com 2011-12-01 01:48:03 2011-12-01 01:50:04 5 HPAIUS D5785.domain.com 2011-12-01 01:17:22 2011-12-01 01:54:44 6 HBRTE D6092.domain.com 2011-12-01 01:51:13 2011-12-01 01:55:03 7 KOLA D6194.domain.com 2011-12-01 01:59:07 2011-12-01 02:03:01 8 MSALA D6147.domain.com 2011-12-01 00:39:54 2011-12-01 02:45:07 9 ESSAA D6142.domain.com 2011-12-01 02:01:34 2011-12-01 02:51:07 10 KOLA D6194.domain.com 2011-12-01 02:55:34 2011-12-01 03:00:24 &gt; </code></pre> <p>Now I would like to calculate <strong>the number of concurrent users</strong> for each minute using start and end times from the <code>tdata</code> dataset. I got this far:</p> <pre><code>#create dataset containing each minute from tdata start.min &lt;- min(tdata$start, na.rm=T) end.max &lt;- max(tdata$end, na.rm=T) tinterval &lt;- seq.POSIXt(start.min, end.max, by = "mins") </code></pre> <p>Any ideas how to proceed with the calculation?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload