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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:44:15+00:00 2026-06-13T03:44:15+00:00

This is a very specific task but I believe the learning from it may

  • 0

This is a very specific task but I believe the learning from it may be general enough to be of use. I have an oddly designed data set of time stamps that I need to reshape and I need to operate out of the packages that come with a base install. I think seeing is easier than explaining.

The list of named vectors with time stamps:

x <- structure(list(A = c("2.40", ":", "3.00", "5.01", "6.62", ":", 
    "7.00", "9.00"), B = c("2.40", "5.01", "6.62", ":", "7.00", "9.00"
    ), C = c("2.40", ":", "3.00", "5.01", "6.62", ":", "7.00", "9.00"
    )), .Names = c("A", "B", "C"))

What the list looks like:

> x
[[1]]
[1] "2.40" ":"    "3.00" "5.01" "6.62" ":"    "7.00" "9.00"

[[2]]
[1] "2.40" "5.01" "6.62" ":"    "7.00" "9.00"

[[3]]
[1] "2.40" ":"    "3.00" "5.01" "6.62" ":"    "7.00" "9.00"

What I’d like:

$A
     start      end  
1   "2.40"   "3.00"   
2   "5.01"   "5.01"    
3   "6.62"   "7.00"   
4   "9.00"   "9.00"  

$B
     start      end 
1   "2.40"   "2.40"   
2   "5.01"   "5.01"  
3   "6.62"   "7:00"   
4   "9.00"   "9.00"   

$C
     start      end 
1   "2.40"   "3.00"
2   "5.01"   "5.01" 
3   "6.62"   "7.00"
4   "9.00"   "9.00"

Where there’s a colon (:) the element on the left is a start value and the element on the right is an end value. If an element is not touching a colon it needs to be repeated and is both the start and end value.

Note: the outcome wouldn’t have quotes if it’s a dataframe vs. a matrix

  • 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-13T03:44:17+00:00Added an answer on June 13, 2026 at 3:44 am

    Is this what you want?

    > lapply(x, function(v)
    +   data.frame(start = v[-c(f <- which(v==":"), f + 1)], 
    +              end = v[-c(f, f-1)]))
    $A
      start  end
    1  2.40 3.00
    2  5.01 5.01
    3  6.62 7.00
    4  9.00 9.00
    
    $B
      start  end
    1  2.40 2.40
    2  5.01 5.01
    3  6.62 7.00
    4  9.00 9.00
    
    $C
      start  end
    1  2.40 3.00
    2  5.01 5.01
    3  6.62 7.00
    4  9.00 9.00
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a very narrow and specific question, but I know there are someone
First of I'm very sorry but this questions is not so so specific. All
This is a very specific question which will probably earn me the tumbleweed badge,
This is a very specific question for a Google Chrome extension. http://www.meebo.com/mobile/ This page
I'm using this very handy plugin to sort elements. But comparing elements on a
Creating a Lisp syntax like DSL - very small specific application - but very
We have a very high performance multitasking, near real-time C# application. This performance was
I need a 3D engine for a very specific task in Artificial Intelligence, and
At first I thought I'm facing a very simple task. But now I realized
I am currently a developer working on a very task specific application; the user(s)

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.