Try this: findInterval(do.call(seq, c(as.list(as.POSIXct(DF$login_time)), by = '30 mins')), as.POSIXct(DF$login_time))
On Fri, Sep 24, 2010 at 4:32 PM, Travers Naran <tna...@gmail.com> wrote: > Hi all, > > Here's what I have. I have a list of log-in times for users and how > long their sessions were. > > user, login_time, session_min > alice, 2010/01/01 10:00, 145 > bob, 2010/01/01 11:00, 30 > > What I want to do is create a bar chart showing, in 1/2 hour segments, > the number of users logged in at the same time. For example: > > 10:00 1 > 10:30 1 > 11:00 2 > 11:30 1 > > The only way I can do this now is to send the data through a Perl > script to generate raw data like: > > alice, 2010/01/01, 10:00 > alice, 2010/01/01, 10:30 > alice, 2010/01/01, 11:00 > ... > bob, 2010/01/01, 11:00 > > I've looked through the man pages for a couple hours now, and I can't > find a better of way of doing this directly in R. Any help or > pointers? Thanks in advance. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.