3

I received this

Error in if (min(corr) < -1 - .Machine$double.eps || max(corr) > 1 + .Machine$double.eps) { : missing value where TRUE/FALSE needed

and I am not sure what it means. I have a missing value in my data and would like to remove that row of data. My previous code for getting a corrplot was

library(corrplot)
C <- cor(SIMPIN_Data)
corrplot(C, method="number", use="complete.obs")

Help? I am very new to R.

My data looks like this

 1-Response time 1-Accuracy 2-Response time 2-Accuracy 3-Response Time 3-Accuracy
1        500         .80             200          .60          100         .99
2        550          NA             250          .30          900         .50
3        550         .20             250          .30          900         .50
Viliam Simko
  • 1,711
  • 17
  • 31
user5162881
  • 171
  • 1
  • 4
  • 9
  • 2
    If would help if you included sample input data to make a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). That would make it easier to help you. – MrFlick Mar 07 '16 at 21:57
  • 2
    Very likely that `min(corr,na.rm=TRUE)` (and the same for the `max` part) will solve the issue. R is telling that the result of the `if` statement is `NA` and so it cannot procede. The `min` and `max` functions return `NA` if an element of the vector is `NA`. – nicola Mar 07 '16 at 23:14
  • Your correaltion matrix has missing (NA) in it, and corrplot will not work with missing. You have used the `use="complete.obs"` in the wrong place - use it in the `cor` function. – user2957945 Mar 08 '16 at 00:54

1 Answers1

2

I just fixed this known corrplot issue "Enable to plot a matrix with NA". See https://github.com/taiyun/corrplot/issues/7

The problem was indeed in min(corr,na.rm=TRUE) and max(corr,na.rm=TRUE) as suggested by @nicola

You can download the latest version from github:

install.packages("devtools")
devtools::install_github("taiyun/corrplot")
Viliam Simko
  • 1,711
  • 17
  • 31