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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:44:04+00:00 2026-05-30T13:44:04+00:00

Trying to learn some R after doing mostly Haskell for rather a long time

  • 0

Trying to learn some R after doing mostly Haskell for rather a long time I got stuck on a problem I would usually have using unzip1 and map.

I have a sequence of strings, each containing two substrings separated by an underscore. I want to “unzip” this sequence into something like a data frame or a matrix, where the first column is the sequence of all the first substrings and the second column the sequence of all the second substrings.

Is there any analogue to unzip in R, and would it be considered ideomatic to use it here, or am I approaching this from alltogether the wrong direction?

[1] Given a list (or more generally any kind of sequence) of pairs unzip produces a pair of lists, in the obvious way.

  • 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-30T13:44:05+00:00Added an answer on May 30, 2026 at 1:44 pm

    You’re on the right track. You want strsplit

    vec <- paste(letters,letters[26:1],sep='_')
    out <- strsplit(vec,'_')
    

    thats a list.. and sapply will get the vectors out.

    data.frame(one = sapply(out,'[',1), two = sapply(out,'[',2))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

trying to learn some html/css and I'm having a problem with fixed position divs.
I'm trying to learn some NHibernate after diving into EF4. Is the equivalent of
I'm trying to learn F# by translating some Haskell code I wrote a very
I am trying to learn some of the basic and advanced features of visual
I am trying to learn some VB.NET for my coo-op that starts next week,
I am trying to learn some ASP.NET MVC. Please bear with me but asp.net
I'm trying to learn some C#.net. I'm just trying to expose the AdventureWorks database
I am working on a little mini compiler while trying to learn some MIPS
I'm trying to do a little PDO CRUD to learn some PDO. I have
I'm trying to learn F# by going through some of the Euler problems and

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.