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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:04:13+00:00 2026-06-11T19:04:13+00:00

I need to extract numeric values from a variable which is a structure combined

  • 0

I need to extract numeric values from a variable which is a structure combined with numeric values and names

structure(c(-1.14332132657709, -1.1433213265771, -1.20580568266868, 
-1.75735158849487, -1.35614113300058), .Names = c("carbon", 
"nanotubes", "potential", "neuron", "cell", "adhesion"))

At the end I would like to have a vector with just this information

c(-1.14332132657709, -1.1433213265771, -1.20580568266868, 
-1.75735158849487, -1.35614113300058)

how can I do it?
many thanks

  • 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-11T19:04:15+00:00Added an answer on June 11, 2026 at 7:04 pm

    Both as.numeric() and unname() do this:

    R> structure(c(-1.14332132657709, -1.1433213265771, -1.20580568266868,
    +              -1.75735158849487, -1.35614113300058, NA),
    +            .Names = c("carbon", "nanotubes", "potential", 
    +            "neuron", "cell", "adhesion"))
       carbon nanotubes potential    neuron      cell  adhesion 
     -1.14332  -1.14332  -1.20581  -1.75735  -1.35614        NA 
    R> foo
       carbon nanotubes potential    neuron      cell  adhesion 
     -1.14332  -1.14332  -1.20581  -1.75735  -1.35614        NA 
    R>
    R> as.numeric(foo)            ## still my 'default' approach
    [1] -1.14332 -1.14332 -1.20581 -1.75735 -1.35614       NA
    R>
    R> unname(foo)                ## maybe preferable though
    [1] -1.14332 -1.14332 -1.20581 -1.75735 -1.35614       NA
    R> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a Javascript bookmarklet, which would extract a numeric ID from
I'm attempting to extract not numeric values from a matrix like this: 32540_at 0.138306
I need to extract the video names from youtube's index.html. I have been able
Need to extract .co.uk urls from a file with lots of entries, some .com
I need to extract a value from a hidden HTML field, have somewhat figured
I need to extract the URL's from the php datas, how can i achieve
I need to extract the arguments from a function Say, Function_1(arg1,agr2,....argn). Is it possible
I need to extract images from a FB fan page. I'm able to read
I need extract data from a string. Heres an example: Mozilla/5.0 (Macintosh; U; PPC
I need to extract the different components from a GPS coordinate string. So for

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.