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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:40:57+00:00 2026-06-18T00:40:57+00:00

I have a directed dyadic data frame that looks like this. ccode.a ccode.b year

  • 0

I have a directed dyadic data frame that looks like this.

       ccode.a ccode.b year  mindist int.a2b
167603     220     570 1976 8.985324       0
624316     781     770 1976 7.914206       0
593896     740     620 1976 9.128673       0
669443     900     660 1976 9.235735       1
323404     434      20 1976 8.764419       0
353101     451     432 1976 5.390160       0
37109       53     700 1976 9.373724       0
624853     790       2 1976 8.949047       0
242472     355      53 1976 9.030233       0
35129       53     350 1976 9.006963       0
481129     600     140 1976 8.377329       0
621802     781     310 1976 8.885368       0
236655     350     600 1976 7.587584       0
192503     290     950 1976 9.636472       1
464722     580      94 1976 9.551535       0
550661     694      42 1976 9.377167       0
585022     712     625 1976 8.586424       0
637007     812       2 1976 8.902645       0
539818     678     572 1976 8.402542       0
690214     950     900 1976 7.859377       1
135804     160     135 1976 6.314121       0
554291     694     811 1976 8.603649       0
496453     620     680 1976 7.565657       0
68160       90     220 1976 9.003781       0
605932     770     482 1976 8.355514       0
509185     640     660 1976 4.873909       0
24928       42     830 1976 9.774045       0
454705     570     666 1976 8.740049       0
92800      100      51 1976 6.631003       1
492025     616     651 1976 7.140152       0
598335     750     663 1976 7.997375       0
485329     615     130 1976 8.951390       0
330093     435     520 1976 8.560956       0
74135       91     570 1976 9.453192       0
465351     580     235 1976 8.989404       1
227129     345     165 1976 9.296795       0
488046     615     696 1976 8.298939       0
381548     483     375 1976 8.325534       0
237750     350     840 1976 9.103709       0
402138     510     265 1976 8.688151       0
372394     475     950 1976 9.798338       0
216445     338     570 1976 8.890926       1
598308     750     660 1976 8.082419       0
613237     775     235 1976 9.100852       0
310790     420      42 1976 8.617836       0
611272     771     696 1976 8.065013       0
183450     235     551 1976 8.739090       0
659939     840     590 1976 8.879307       0
506308     640      70 1976 9.232063       0
188756     290      91 1976 9.120557       1

I want to create a matrix of all of the pairs of ccode.a and ccode.b,

d.sender <- matrix(0, nrow = 192, ncol = 192, dimnames = list(unique(dyad$ccode.a), unique(dyad$ccode.a)))

And then assign the value of int.a2b (I’ll have to do this for a bunch of variables) to the appropriate cell in the matrix. This will be done separately for each year in the data set. Since the data frame is directed dyadic I’ll also have a receiver matrix of the same dimension that that mirrors the sender matrix I’m trying to create now.

  • 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-18T00:40:59+00:00Added an answer on June 18, 2026 at 12:40 am

    If I am correct in understanding what you want, here is one way:

     x <- data.frame(a=(1:3),b=(4:6),val=c(8,3,7))
     library(reshape2)
    
     acast(x, a~b, value.var="val")
    #   4  5  6
    #1  8 NA NA
    #2 NA  3 NA
    #3 NA NA  7
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large directed acyclic graph that I would like to visualize in
I have a directed-graph, each node is a complex data type. Does anyone know
I have an unweighted directed graph that may or may not have cycles in
I have a d3 force-directed graph that contains a group of nodes: var node
I have an acyclic directed graph. I would like to assign levels to each
I have a directed graph described by A -> B meaning that there exists
I have a directed graph whose vertices have costs. I would like to find
I have a directed acyclic graph with nodes that are lists of entries that
I would like to have users be directed to a link which will immediately
I have nodes in a D3 force-directed layout that are set to . fixed

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.