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

  • SEARCH
  • Home
  • 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 8132833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:26:11+00:00 2026-06-06T09:26:11+00:00

how can I have a data set of only time intervals (no dates) in

  • 0

how can I have a data set of only time intervals (no dates) in R, like the following:

TREATMENT_A TREATMENT_B

1:01:12 0:05:00

0:34:56 1:08:09

and compute mean times, etc, and draw boxplots with time intervals in the y-axis?

I am new to R, and I searched for this but found no example in the net.

Thanks

  • 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-06T09:26:14+00:00Added an answer on June 6, 2026 at 9:26 am

    The chron-package has a ‘times’ class that supports arithmetic. You could also do all of that with POSIXct objects and format the date-time output to not include the date. I thought axis.POSIXct function has a format argument that should let you have time outputs. However, it does not seem to get dispatched properly, so I needed to construct the axis “by hand.”

    dft <- data.frame(x= factor( sample(1:2, 100, repl=TRUE)), 
                      y= Sys.time()+rnorm(100)*4000 )
    boxplot(y~x, data=dft, yaxt='n')
    axis(2, at=seq(from=range(dft$y)[1], to =range(dft$y)[2], by=3000) , 
             labels=format.POSIXct(seq(from=range(dft$y)[1], to =range(dft$y)[2], by=3000), 
                                     format ="%H:%M:%S") )
    

    enter image description here

    There did turn out to be an appropriate method, Axis.POSIXt (to which I thought boxplot should have been turning for plotting, but it did not seem to recognize the class of the ‘y’ argument):

    boxplot(y~x, data=dft, yaxt='n')
    Axis(side=2, x=range(dft$y), format ="%H:%M:%S")
    

    enter image description here

    Regarding your request for something “simpler”, take a look at theis ggplot2 based solution, using the dft dataframe defined above with POSIXct times. (I did try with the chron-times object but got a message saying ggplot did not support that class):

    require(ggplot2); p <- ggplot(dft, aes(x,y))
    p + geom_boxplot()
    

    enter image description here

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

Sidebar

Related Questions

I have a small data set of a moving car: Data_=[time x,y,z]; %# ONLY
I have a set of data with over 1000 entries. I can filter these
I have situation where a user can manipulate a large set of data (presented
I have a table like this: Application,Program,UsedObject It can have data like this: A,P1,ZZ
In Java is there an object like a Set that can contain only unique
I want my flot graph to update it's data on set intervals. I have
I have a sample data like this ID DATE TIME STATUS --------------------------------------------- A 01-01-2000
I have big dataset (but the following is small one for example). I can
On a Java portal you can have portlets that include data provided by other
I have a data in NSMutableData type. Can I convert the data to a

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.