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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:59:09+00:00 2026-06-10T23:59:09+00:00

I often deal with objects of this form: v <- list(one = c(a =

  • 0

I often deal with objects of this form:

v <- list(one = c(a = 1, b = 2, c = 3), two = c(a = 10, b = 20, d = 30, c = 40))

and I would like to outer join these vectors by element name, to obtain:

  index value.x value.y
1     a       1      10
2     b       2      20
3     c       3      40
4     d      NA      30

I have written code to do this. In a nutshell, converts the vectors to data frames and reduces via successive merges. But I wonder if I have been reinventing the wheel and there is some function contained in a package, or in R base, possibly optimized. It seems a very common task.

  • 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-10T23:59:11+00:00Added an answer on June 10, 2026 at 11:59 pm

    Not sure this will be any simpler than your approach, but you could use reshape2 , lapply and as.list. I think the melt `dcast

    library(reshape2)
    dcast(melt(lapply(v, as.list)), L2 ~L1)
    ##   L2 one two
    ## 1  a   1  10
    ## 2  b   2  20
    ## 3  c   3  40
    ## 4  d  NA  30
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Often times I write some SQL like this: string sql = @ -- Multi-line
Often when writing PHP I'll have it output some HTML like this - echo
Often, I would like to build up complex regexps from simpler ones. The only
I often come across a scenario where I have two collections of objects (either
Using ValueInjecter, I often find myself writing code like this: var foo1 = new
Quite often we deal with lists of things on our site. These initially get
I often have to deal with XML documents that contain namespaced elements, but doesn't
Often I find myself in a situation where I have to deal with catching
At work, I often have to deal with 3rd party libraries, which make heavy
I deal with numeric data that is often edited up or down by 0.01*Value_of_variable,

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.