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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:55:08+00:00 2026-06-06T23:55:08+00:00

I couldn’t think how to title this one well, what I have is a

  • 0

I couldn’t think how to title this one well, what I have is a vector of objects generated by a function (specifically midPci) of this form:

$conf.int
[1] 0.4726 0.6466
attr(,"conf.level")
[1] 0.95

$conf.int
[1] 0.1181 0.2566
attr(,"conf.level")
[1] 0.95

What I want to do is strip out the two values of $conf.int into vectors giving the upper and lower confidence intervals. Obviously I can do this with a loop, but I figured there was probably a better way to do this?

CIs <- structure(list(conf.int = structure(c(0.4696, 0.6501), conf.level = 0.95), 
 conf.int = structure(c(0.5266, 0.7081), conf.level = 0.95), conf.int = structure(c(0.4441, 
 0.6196), conf.level = 0.95), conf.int = structure(c(0.4181, 0.5891), conf.level = 0.95), 
 conf.int = structure(c(0.4726, 0.6466), conf.level = 0.95), conf.int = structure(c(0.1181, 
 0.2566), conf.level = 0.95), conf.int = structure(c(0, 0.000748652688017826), conf.level = 
 0.95)), .Names = c("conf.int", "conf.int", "conf.int", "conf.int", "conf.int", "conf.int", 
 "conf.int" ))

In case it’s not clear what I mean, I’ve done this:

# Calculate CIs
CIs <- mapply(midPci, k, n, conf.level=0.95)

And I can get the individual values I’m after out by doing CIs[1]$conf.int[1], etc., but I want to get the whole lot out in one go. Can I do this?

  • 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-06T23:55:09+00:00Added an answer on June 6, 2026 at 11:55 pm

    This produces a matrix:

    do.call(rbind, CIs)
    
               [,1]         [,2]
    conf.int 0.4696 0.6501000000
    conf.int 0.5266 0.7081000000
    conf.int 0.4441 0.6196000000
    conf.int 0.4181 0.5891000000
    conf.int 0.4726 0.6466000000
    conf.int 0.1181 0.2566000000
    conf.int 0.0000 0.0007486527
    

    This also produces a matrix, although it is the ‘wide version’. The c function applied to a vector just returns itself , and you could have used as.vector or I and gotten the same result. It is really the function simplify2array(CIs) that is called by sapply that is doing the work:

     sapply(CIs, "c")
         conf.int conf.int conf.int conf.int conf.int conf.int     conf.int
    [1,]   0.4696   0.5266   0.4441   0.4181   0.4726   0.1181 0.0000000000
    [2,]   0.6501   0.7081   0.6196   0.5891   0.6466   0.2566 0.0007486527
    

    And had we used do.call(cbind, CIs) we would have gotten the ‘wide version’ as well.

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

Sidebar

Related Questions

Sorry couldn't think of a better title. :) Here goes, I have been pulling
Couldn't find an answer to this one. I have a WPF ListView control that
(Couldn't think of any simpler way to write the title for this, but the
I couldn't find anything similar to this anywhere. I have an array of pointers
I couldn't find this in the documentation. If I have a complex object in
I couldn't think of a way to word the title, so sorry for that,
I couldn't find a suitable title for this. I'm going to express my query
(couldn't think of a better title, feel free to edit it to a title
Couldn't think of a more appropriate question title, but I'm looking for some advice
Couldn't find a function for this. I'm assuming I need to use regex? I'm

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.