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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:48:58+00:00 2026-06-15T23:48:58+00:00

Using R, what is the best way to read a symmetric matrix from a

  • 0

Using R, what is the best way to read a symmetric matrix from a file that omits the upper triangular part. For example,

1.000
.505  1.000
.569  .422  1.000
.602  .467  .926  1.000
.621  .482  .877  .874  1.000
.603  .450  .878  .894  .937  1.000

I have tried read.table, but haven’t been successful.

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

    Here’s a read.table and loopless and *apply-less solution:

    txt <- "1.000
    .505  1.000
    .569  .422  1.000
    .602  .467  .926  1.000
    .621  .482  .877  .874  1.000
    .603  .450  .878  .894  .937  1.000"
     # Could use clipboard or read this from a file as well.
    mat <- data.matrix( read.table(text=txt, fill=TRUE, col.names=paste("V", 1:6))  )
    mat[upper.tri(mat)] <- t(mat)[upper.tri(mat)]
    > mat
            V1    V2    V3    V4    V5    V6 
    [1,] 1.000 0.505 0.569 0.602 0.621 0.603
    [2,] 0.505 1.000 0.422 0.467 0.482 0.450
    [3,] 0.569 0.422 1.000 0.926 0.877 0.878
    [4,] 0.602 0.467 0.926 1.000 0.874 0.894
    [5,] 0.621 0.482 0.877 0.874 1.000 0.937
    [6,] 0.603 0.450 0.878 0.894 0.937 1.000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the best way to read a line from a file using the New
What is the best way to read entries programatically from Blogger using .NET/C#?
What's the best way to read a text file using T-SQL? I've seen the
what is best way to send email from PHP using server authantication. Userid &
What is the best way/library to read Excel 2003 and 2007 files using C#?
What is the best way to save a file to my SQL database using
When I'm using a Text reader what is the best way to detect that
Couple questions. Whats the best way to access a live .db file using sqlite
What's the best way to read properties from the GWT host page? I'm trying
What's the best way to import a small csv file into SQL Server using

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.