Skip to content
Prev 305308 / 398506 Next

How to resolve the following error: (list) object cannot be coerced to type 'double'

Hello,

The input must be a matrix, not a list (or its special case data.frame).

Var <- read.table(text="
   D.Prime    T.statistics
1    1.7234e-01     4.926800
2    1.4399e-01     2.892000
3    1.4626e-01     2.642800
4    3.5147e-02     1.112400
5    5.8957e-02     2.723700
", header=TRUE)

# library(Hmisc)
rc <- rcorr(as.matrix(Var), type="pearson")
# from recommended package stats
ct <- cor.test(Var$D.Prime, Var$T.statistics, method = "pearson")

rc$P
                D.Prime T.statistics
D.Prime             NA    0.1101842
T.statistics 0.1101842           NA

ct$p.value
[1] 0.1101842

To the op: you should say which library you are using. Even if Hmisc is 
a very popular one.

Hope this helps,

Rui Barradas


Em 12-09-2012 16:10, R. Michael Weylandt escreveu: