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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:41:43+00:00 2026-05-27T20:41:43+00:00

I have a factor variable which is comprised of times. When I attempt to

  • 0

I have a factor variable which is comprised of times. When I attempt to turn it into a factor, R orders them in order from lowest to highest. Unforunately, this means that I end up with something like the following:

1:48:55  1:53:11  1:58:18  10:04:01 10:12:45 10:14:16 
10:20:24 10:21:59 10:23:11 10:23:40 10:30:40 10:34:13 
10:39:47 10:54:33 10:58:43 3:21:59  3:27:38  3:37:58  
3:49:00 4:20:42  4:30:52  4:37:39  4:40:08  4:40:55  
4:42:25  5:03:25  5:10:30  5:10:49  5:12:39  5:14:20

So instead of printing the times in order, times with 10:00 come before 7:00.

Is there a quick way to order the times by the actual time?

    time = c("1:48:55", "1:53:11", "1:58:18", "10:04:01", "10:12:45", "10:14:16", "10:20:24", "10:21:59", "10:23:11", "10:23:40", "10:30:40", "10:34:13", "10:39:47", "10:54:33", "10:58:43", "3:21:59", "3:27:38", "3:37:58", "3:49:00", "4:20:42", "4:30:52", "4:37:39",  "4:40:08", "4:40:55", "4:42:25", "5:03:25", "5:10:30", "5:10:49", "5:12:39", "5:14:20")

time = factor(time)
  • 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-27T20:41:44+00:00Added an answer on May 27, 2026 at 8:41 pm

    Try this:

    library(chron)
    sort(times(time))
    

    or this if you want the sorted vector to remain a factor:

    time[order(times(time))]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data set representing data from a log file which shows users
OK, I have this benchmark from SPLASH2 which I am using to test a
I have a Unit testing problem where a class has a static variable which
I have a rules engine, which supports two modes of operations: Compilation into a
I have a dataframe of which the columns contain a variable amount of numbers
I have a database which stores temperature-logging data from various instruments. Data may be
I have data frame with some numerical variables and some categorical factor variables. The
Do you plan on using Factor ? Have you looked at it? Checked it
I have a factory class, DocumentLoaderFactory , which simply returns an instance that implements
I have a problem at hand which I'd think is fairly common amongst groups

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.