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 8977575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:24:12+00:00 2026-06-15T19:24:12+00:00

I am trying to create a text-output of backup-durations sorted into 30-minute increment bins

  • 0

I am trying to create a text-output of backup-durations sorted into 30-minute increment bins for 6 of our backup servers. An example of the input data (called newdata) is as follows:

      backup_server   client      duration  
1     bkp01           server_A    60       
2     bkp01           server_A    34       
3     bkp01           server_A    230     
4     bkp02           server_A    14      
5     bkp02           server_C    29   
6     bkp02           server_C    62

Now I’ve been able to bin everything together with:

br.br <-seq(0,max(newdata$duration),by=30)
cbind(table(cut(newdata$duration,br.br,right=FALSE)))

Which provides this kind of output:

                    [,1]
[0,30)              3523
[30,60)             1394
[60,90)              230
[90,120)              35
[120,150)             10
[150,180)              0
[180,210)              3

What I’d like to see is something like this:

[,1]                bkp01      bkp02
[0,30)               523        422
[30,60)              394         30
[60,90)              130         10
[90,120)               5          3
[120,150)              1          2
[150,180)              0         10
[180,210)              2         20

The closest I got was using the aggregate function but doesn’t really do what I need.

> aggregate(newdata$Duration, by=list(newdata$TSM_server),FUN=mean)
  Group.1        x
1 bkp01       31.13307
2 bkp02       16.58491
  • 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-06-15T19:24:13+00:00Added an answer on June 15, 2026 at 7:24 pm

    If this is not what you want (and by comparing @joran’s solution to mine you should see that there is considerable ambiguity to be resolved regarding what summary measure is desired)….

     aggregate(newdata$Duration, 
               by=list(dur.cut=cut(newdata$duration,br.br,right=FALSE) , 
                       server=newdata$TSM_server),
                FUN=mean) 
    

    Then try this:

     tapply( newdata$Duration, 
               INDEX=list(dur.cut=cut(newdata$duration,br.br,right=FALSE) , 
                       server=newdata$TSM_server),
                FUN=mean)
    

    Sometimes setting INDEX= interaction(var1, var2) produces slightly different and at times more desirable results. ( In testing these I do observe that the column names are different than your example.)

     aggregate(newdata$duration, 
                by=list(dur.cut=cut(newdata$duration,br.br,right=FALSE) , 
                        server=newdata$backup_server),
                 FUN=mean)
    #------------
      dur.cut server    x
    1 [30,60)  bkp01 34.0
    2 [60,90)  bkp01 60.0
    3  [0,30)  bkp02 21.5
    4 [60,90)  bkp02 62.0
    
     tapply( newdata$duration, 
                INDEX=list(dur.cut=cut(newdata$duration,br.br,right=FALSE) , 
                        server=newdata$backup_server),
                 FUN=mean)
    #-------------
               server
    dur.cut     bkp01 bkp02
      [0,30)       NA  21.5
      [30,60)      34    NA
      [60,90)      60  62.0
      [90,120)     NA    NA
      [120,150)    NA    NA
      [150,180)    NA    NA
      [180,210)    NA    NA
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an inventory list (tab-delimited text, for the output) from XML
I am trying to create a tab delimeted text file so that the output
i am trying to create a transformation which output will be text but including
I'm trying to create text in html, that once clicked, the the value of
I am trying to create a text highlight option for my website. But I
I am trying to create a text file using VB.Net with UTF8 encoding, without
I am trying to create full text index but I am getting error which
I am trying to create a text-based game in Java similar to Zork and
I'm trying to create a text-based game on the Windows phone. My thought is
I am trying to create a text field in objective-c with a big corner

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.