Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7164319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:03:22+00:00 2026-05-28T14:03:22+00:00

I have a data set representing data from a log file which shows users

  • 0

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:

tdata <- 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")

> 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
>

Now I would like to calculate the number of concurrent users for each minute using start and end times from the tdata dataset. I got this far:

#create dataset containing each minute from tdata
start.min <- min(tdata$start, na.rm=T)
end.max <- max(tdata$end, na.rm=T)
tinterval <- seq.POSIXt(start.min, end.max, by = "mins")

Any ideas how to proceed with the calculation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:03:22+00:00Added an answer on May 28, 2026 at 2:03 pm

    Here is an example

    n <- sapply(tinterval, function(tt) sum(tdata$start <= tt & tt <= tdata$end))
    

    then

    @> tail(data.frame(tinterval, n))
                   tinterval n
    3922 2011-12-01 09:55:06 0
    3923 2011-12-01 09:56:06 1
    3924 2011-12-01 09:57:06 1
    3925 2011-12-01 09:58:06 1
    3926 2011-12-01 09:59:06 1
    3927 2011-12-01 10:00:06 1
    @> plot(tinterval, n, type = "l")
    

    quite slow though…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Interpolating Large Datasets I have a large data set of about 0.5million records representing
I have a data set which consists of an ID and a matrix (n
I have two lists of two different kinds of objects representing data rows from
I have written an importer which copies data from a flat table into several
I have a php page pulling data from a sql2000 stored procedure representing the
I have a data set whose elements are displayed as rows in a DataGrid.
I have a data set that is organized in the following manner: Timestamp|A0001|A0002|A0003|A0004|B0001|B0002|B0003|B0004 ...
I have a data set that looks like this: 000 100 200 300 010
I have a data set with over 50,000 geocoded points (lat-long). Each point has
I have a data set that is around 700 rows with eight columns of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.