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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:27:20+00:00 2026-05-20T00:27:20+00:00

I have a large correlation matrix result in R – for now about 30

  • 0

I have a large correlation matrix result in R – for now about 30 items correlated against each other – so the array has about 10,000 cells. I want to find the largest 5 and smallest 5 results. How can I do this?

Here’s what a very small portion – the upper left corner – looks like:

               PL1         V3          V4         V5
PL1     1.00000000 0.19905701 -0.02994034 -0.1533846
V3      0.19905701 1.00000000  0.09036472  0.1306054
V4     -0.02994034 0.09036472  1.00000000  0.1848030
V5     -0.15338465 0.13060539  0.18480296  1.0000000

The values in the table are always between 1 & -1 and if it helps, being a correlation matrix the upper half above the diagonal is a duplicate of the lower half below the diagonal.

I need the most positive 5 less than 1 and the most negative 5 including -1 if it exists.

Thanks in advance.

  • 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-05-20T00:27:21+00:00Added an answer on May 20, 2026 at 12:27 am

    You want to find the largest and smallest correlations and probably know not only what, but where those values came from. It’s easy.

    x<-matrix(runif(25),5,5)
    cor<-cor(x)
    l <- length(cor)
    l1 <- length(cor[cor<1])
    
    #the actual high and low correlation indexes 
    corHigh <- order(cor)[(l1-4):l1]
    corLow <- order(cor)[1:5]
    #(if you just want to view the correlations cor[corLow] or cor[corHigh] works fine)
    
    #isolate them in the matrix so you can see where they came from easily
    corHighView <- cor
    corHighView[!1:l %in% corHigh] <- NA
    corLowView <- cor
    corLowView[!1:l %in% corLow] <- NA
    
    #look at your matrix with your target correlations sticking out like a sore thumb
    corLowView
    corHighView
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large text template which needs tokenized sections replaced by other text.
I have large main file contains about 7,000 lines of C code. If I
I have a large array (say 512K elements), GPU resident, where only a small
I have large data sets (10 Hz data, so 864k points per 24 Hours)
I have large batches of XHTML files that are manually updated. During the review
I'm developing a website in PHP and I have large JS files that I
I have a large tree of Java Objects in my Desktop Application and am
I have a large codebase that targetted Flash 7, with a lot of AS2
I have a large database and would like to select table names that have
I have a large table with 1 million+ records. Unfortunately, the person who created

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.