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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:39:28+00:00 2026-05-24T10:39:28+00:00

I have following matrix wanted to create heatmap in R E1 E2 P1 P2

  • 0

I have following matrix wanted to create heatmap in R

    E1  E2  P1   P2
E1  1   0.73867 0.865486 0.708944
E2      1   0.749623 0.949532
P1          1    0.747194
P2              1

I used following code to achieve it

acc<-read.csv("data.csv",header=TRUE,sep=",")

row.names(acc)<-acc[,1]

acc <- acc[,2:dim(acc)[2]]

acc_matrix<-data.matrix(acc)

acc_map <- heatmap_2(acc_matrix,Rowv=NA, Colv=NA, col = rev(heat.colors(256)),scale="none",legend=1)

But im getting error as follows

Error in `[.data.frame`(acc, , 1:dim(acc)[1]) : 
  undefined columns selected

Can anybody please help how to solve this…

Thanks

NI

  • 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-24T10:39:28+00:00Added an answer on May 24, 2026 at 10:39 am

    Here’s one solution using the ggheat function.

    mat <- matrix(NA,ncol=4,nrow=4)
    diag(mat) <- 1
    library(gdata)
    upperTriangle(mat) <- runif(6)
    colnames(mat) <- rownames(mat) <- c("E1","E2","P1","P2")
    ggheat(mat)
    

    ggheat

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

Sidebar

Related Questions

I have several blocks of the following code that each use there own matrix.
I want to achieve the following: Have a AxBxC matrix (where A,B,C are integers).
I am reading a matrix from a file and have the following code: int
I have the following code to create a jpg file from a movieclip: var
I currently have the following code: type Matrix(sourceMatrix:double[,]) = let rows = sourceMatrix.GetUpperBound(0) +
I have the following code in the caller function int matrix[3][3] = {{1, 2,
I have the following code: template <typename M> struct Matrix { Matrix(int size);//(int x
Say I have the following matrix: A = randi(10, [6 3]) 7 10 3
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following Code Block Which I tried to optimize in the Optimized section

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.