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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:25:19+00:00 2026-06-11T00:25:19+00:00

The text below is an output in text format. I want to retain or

  • 0

The text below is an output in text format. I want to retain or extract only the numeric part of a string using R. For example, I want to extract 56.1129 (as numeric) from a file containing the text below. I am reading the text line by line and would like to extract the value associated with ‘1 Animal’. It would be great if I could convert them to columns and extract lines 2 (Variance) and 3 (pheno1) as well.

---------------------------- -------------------------------------
           - - - Results from analysis of BBBt - - -

   1 Animal                   56.1129    
   2 Variance                 47.6055    
   3 pheno1  1                 103.72       0.92562    
Her1        = Animal     1/pheno1     3=          0.5410    0.0162
Notice: The parameter estimates are followed by their approximate standard errors.
----------------------------------------------------------------
  • 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-11T00:25:21+00:00Added an answer on June 11, 2026 at 12:25 am

    One option is to treat this as a fixed width file and use read.fwf:

    txt <- "---------------------------- -------------------------------------
               - - - Results from analysis of BBBt - - -
    
       1 Animal                   56.1129    
       2 Variance                 47.6055    
       3 pheno1  1                 103.72       0.92562    
    Her1        = Animal     1/pheno1     3=          0.5410    0.0162
    Notice: The parameter estimates are followed by their approximate standard errors.
    ----------------------------------------------------------------"
    

    Read the data:

    read.fwf(textConnection(txt), widths=c(4, 23, 10), skip=3, nrows=3)
    

    The result is a data frame that you can then manipulate as you wish.

      V1                      V2       V3
    1  1  Animal                  56.1129
    2  2  Variance                47.6055
    3  3  pheno1  1              103.7200
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to parse the following format @[Alphanumeric1](Alphanumeric2:Alphanumeric3) from a long string. Below is
I have a string in the format of [text][text][text][text][text] and I want to transform
The text below is from sitemaps.org. What are the benefits to do that versus
I have a paragraph of text below that I want to use an input
Is is possible to update the text 'changethis' in below div using jquery ?
I'm trying convert xml from one format to other using the XslCompiledTransform in c#.
The excerpt below is part of a .ajax() function I'm using to pull data
I'm attempting to use boost::format, where my formatting string is the HTML below. I
I want to generate a string like the one mentioned below in C# code
I want to get a content page from Wiki in this format (the picture

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.