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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:32:17+00:00 2026-06-09T18:32:17+00:00

Possible Duplicate: split and combine by factor into new columns Using example data here

  • 0

Possible Duplicate:
split and combine by factor into new columns

Using example data here for easier illustrative purposes.
I have the full greek alphabet as my sample set.
I also have the full latin alphabet.

I’m currently working with a table that looks like this. This would be a small subset. My actual data is in the 100s of thousands of rows.

sample  call    letter
alpha   y       A
alpha   y       D
alpha   n       C
beta    y       F
beta    y       B
gamma   n       F
gamma   y       B
gamma   n       A
delta   m       E
epsilon n       F
epsilon n       C
epsilon n       B
zeta    m       A
zeta    y       D

I would like to make a final table where the greek alphabet are rows and the columns are the latin alphabet and I’d only provide the “call” whenever available, otherwise NA or 0 could be the entry.

End result would be something like so.

        A   B   C   D   E   F
alpha   y   NA  n   y   NA  NA
beta    NA  y   NA  NA  NA  y
gamma   n   y   NA  NA  NA  n
delta   NA  NA  NA  NA  m   NA
epsilon NA  n   n   NA  NA  n
zeta    m   NA  NA  y   NA  NA

Any idea how I could achieve something like this? Even a general pointer into what would be great.

Thanks in advance.

  • 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-09T18:32:18+00:00Added an answer on June 9, 2026 at 6:32 pm

    dcast from the reshape2 package does this nicely

    library(reshape2)
    dat <- structure(list(sample = c("alpha", "alpha", "alpha", "beta", "beta", "gamma", "gamma", "gamma", "delta", "epsilon", "epsilon", "epsilon", "zeta", "zeta"), call = c("y", "y", "n", "y", "y", "n", "y", "n", "m", "n", "n", "n", "m", "y"), letter = c("A", "D", "C", "F", "B", "F", "B", "A", "E", "F", "C", "B", "A", "D")), .Names = c("sample", "call", "letter"), class = "data.frame", row.names = c(NA, -14L))
    
    dcast(dat, sample ~ letter, value.var='call')
    
    
       sample    A    B    C    D    E    F
    1   alpha    y <NA>    n    y <NA> <NA>
    2    beta <NA>    y <NA> <NA> <NA>    y
    3   delta <NA> <NA> <NA> <NA>    m <NA>
    4 epsilon <NA>    n    n <NA> <NA>    n
    5   gamma    n    y <NA> <NA> <NA>    n
    6    zeta    m <NA> <NA>    y <NA> <NA>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How do you split a list into evenly sized chunks in Python?
Possible Duplicate: CSV parser/reader for C#? I want to split the text using the
Possible Duplicate: Splitting one column into two columns in SQL Server CE I am
Possible Duplicate: Split array into chunks I am trying to convert an array of
Possible Duplicate: How do you split a list into evenly sized chunks in Python?
Possible Duplicate: Split A4 PDF page into two A5 and back again I have
Possible Duplicate: Split String into smaller Strings by length variable I have seen solutions
Possible Duplicate: How to split string into array as integers I have a 3x2
Possible Duplicate: How can I split an IEnumerable<String> into groups of IEnumerable<string> I have
Possible Duplicate: Why (and how) to split column using master..spt_values? I have seen something

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.