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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:44:00+00:00 2026-06-03T00:44:00+00:00

I have a huge data set with genotypic information from different populations. I would

  • 0

I have a huge data set with genotypic information from different populations. I would like to sort the data by population, but I don’t know how.

I would like to sort by “pedigree_dhl”. I was using the following code, but I kept getting error messages.

newdata <- project[pedigree_dhl == CCB133$*1,  ]

My problem is also, that ‘pedigree-dhl’ contains all the names of the individual genotypes. Only the first 7 letters in the column ‘pedigree-dhl’ are the population name.In this example:CCB133. How can I tell R, that I want to extract the data for all columns, that contain CCB133?

  Allele1 Allele2      SNP_name gs_entry pedigree_dhl
1       T       T ZM011407_0151      656    CCB133$*1
2       T       T ZM009374_0354      656    CCB133$*1
3       C       C ZM003499_0591      656    CCB133$*1
4       A       A ZM003898_0594      656    CCB133$*1
5       C       C ZM004887_0313      656    CCB133$*1
6       G       G ZM000583_1096      656    CCB133$*1
  • 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-03T00:44:00+00:00Added an answer on June 3, 2026 at 12:44 am

    You may want to consider grep as in the answer on Using regexp to select rows in R dataframe. Adapted to your data:

    df <- read.table(text="  Allele1 Allele2      SNP_name gs_entry pedigree_dhl
    1       T       T ZM011407_0151      656    CCB133$*1
    2       T       T ZM009374_0354      656    CCB133$*1
    3       C       C ZM003499_0591      656    CCB133$*1
    4       A       A ZM003898_0594      656    CCB133$*1
    5       C       C ZM004887_0313      656    CCB133$*1
    6       G       G ZM000583_1096      656    CCB133$*1", header=T)
    
    # put into df1 all rows where pedigree_dhl starts with CCB133$
    p1 <- 'CCB133$'
    df1 <- subset(df, grepl(p1, pedigree_dhl) )
    

    But your question implies that you may want to select out the seven letter name, or just to sort the rows by pedigree name and it may be easier to keep all rows together in a sorted dataframe. All these three operations: sub-setting, extracting a new column, or sorting, may be carried out independently.

    # If you want to create a new column based
    # on the first seven letter of SNP_name (or any other variable)
    
    df$SNP_7 <- substr(df$SNP_name, start=1, stop=7)
    
    # If you want to order by pedigree_dhl
    # then you don't need to select out the rows into a new dataframe
    
    df <- df[ with(df, order(df$pedigree_dhl)), ]
    

    All this may be obvious — I add them simply for completeness.

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

Sidebar

Related Questions

I have a selection of a huge set of data and I would like
I have a huge data set. The structure looks something like this: K_Field1, K_Field2,
I have a huge set of data and want to display the data with
I have a huge set of data of tables in Open Office 3.0 document
I currently work with OpenLayers and have a huge set of data to draw
I have written a program which works on huge set of data. My CPU
I have a huge collection of visual foxpro dbf files that I would like
I have a set of flags which are part of a huge text data
Here is the situation: I have a huge data set that I need quick
I have a huge data set and I want to extract the rows which

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.