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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:44:24+00:00 2026-06-06T07:44:24+00:00

I would like to plot a heatmap on a table imported from MATLAB. The

  • 0

I would like to plot a heatmap on a table imported from MATLAB. The table has explicited rownames and colnames and I have loaded it into R with read.table, and I can run summary(i) and get the numeric summaries for each column:

i = read.table("file.txt",header=TRUE)

But when I try to run heatmap, it complains the converted matrix is not numeric, both with and without rownames.force=TRUE:

is.matrix(as.matrix(i,rownames.force=TRUE))
[1] TRUE

heatmap(as.matrix(i,rownames.force=TRUE))
 Error in heatmap(as.matrix(i, rownames.force = TRUE)) : 
   'x' must be a numeric matrix

I think the problem is that as.matrix tries to convert the non-numeric rowname (or colname, I am not sure anymore :-():

as.matrix(i)[1]
[1] "cluster-594-walk-0161"

Any ideas?

  • 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-06T07:44:25+00:00Added an answer on June 6, 2026 at 7:44 am

    Without a reproducible example we are left guessing what goes wrong, but the error suggests that the matrix does not contain numbers but (probably) characters. Does this work:

    i = as.numeric(i)
    heatmap(as.matrix(i,rownames.force=TRUE))
    

    and what is the output of:

    is.numeric(as.matrix(i)[1])
    

    (probably FALSE).


    edit:
    Your edit shows that the matrix contains characters, not numerics. It may be that in the text file the rownames are included as an additional column, probably the first one. In that case:

    i = read.table("file.txt", header = TRUE, row.names = 1)
    

    reads the first column as the rownames. So the problem is most likely in read.table, not in the conversion to a matrix.

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

Sidebar

Related Questions

I would like to plot connected points in MATLAB. My connected points come from
I have a large real 1-d data set called r. I would like plot:
I have several file with the following format: lat,lon,value. I would like to plot
I would like to plot results from a MDS analysis with 3 dimensions using
I would like to plot the greasy test signal in Matlab, and then plot
I would like to plot the shifted logistic function as shown from Wolfram Alpha
I have multiple vectors of varying lengths that I would like to plot next
I have an SVM in R and I would now like to plot the
I have a dataset with labels which I would like to plot with points
I have param as a matrix like below; I would like to plot param.num_av_BS

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.