[R] Odp: Error in as.double.default(x) : (list) object cannot be coerced to 'double'
Petr PIKAL
petr.pikal at precheza.cz
Wed Aug 8 11:54:07 CEST 2007
Hi
Far from beeing an expert I can decide from your post that you probably
mix R objects matrix x data frame x list. All of them have specific
features and you sometimes cannot convert one to another easily. See what
your objects are and how they look like by e.g.
str(X1)
or mode or typeof
I suspect that your X are lists and using c(some lists) result again into
list.
Plot expect x and y values usually as vectors but there are plot methods
for other objects (data.frames, functions, ...)
Best starting point would be help page for plot.
Regards
Petr
r-help-bounces at stat.math.ethz.ch napsal dne 07.08.2007 15:33:41:
> Dear experts,
>
> I have in all 14 matrices which stands for gene expression divergence
and 14
> matrices which stands for gene sequence divergence. I have tried joining
them
> by using the concatanation function giving
>
> SequenceDivergence <- c(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14)
> ExpressionDivergence <-
c(Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8,Y9,Y10,Y11,Y12,Y13,Y14)
>
> where X1,X2..X14 are the expression matrices containing r-values and
> Y1,Y2..Y14 are the ones with patristic distances
>
> Now, I want to plot SequenceDivergence vs. Expression Divergence
>
> Tried doing that using plot (Sequence Divergence vs. Expression
Divergence)
>
> But then getting the error
>
> Error in as.double.default(x) : (list) object cannot be coerced to
'double'
>
> Note: The diagonal values for X1 was neglected as its seems to give some
bias
> in my results. Code to derive X1,X2,X3..and Y1,Y2,Y3 is given as:
>
> > EDant <- read.table("C:/ant.txt",sep="\t")
> > ED1 <- as.matrix(EDant)
> > X1 <- lapply(1:ncol(ED15), function(a) ED15[-a, a]) # to neglect
diagonal values
>
> I am attaching couple of matrices for your reference. ANT.txt is X1
after
> deleting the diagnol values, similarly,ANTEXP.TXT is Y1, apetella.txt
is X2 and
> apetellaexp.txt is Y2
>
> I tried reading R-manual and other sources but have'nt cracked it yet.
Can
> anyone please help me regarding that?
>
> Thanks very much
>
> Yours sincerely,
>
> Urmi Trivedi.
>
>
>
> ---------------------------------
> Once upon a time there was 1 GB storage in your inbox. Click here for
happy
> ending.0 1.21133 1.420221 1.499358 1.475149 1.513886 1.608816
1.
> 675916 1.859038 1.992958 2.420123 2.309414 2.413222
> 1.21133 0 1.463585 1.542722 1.518513 1.55725 1.65218 1.71928
> 1.902402 2.036322 2.463487 2.352778 2.456586
> 1.420221 1.463585 0 1.418619 1.39441 1.433147 1.528077
1.595177
> 1.778299 1.912219 2.339384 2.228675 2.332483
> 1.499358 1.542722 1.418619 0 0.931235 0.969972 1.354498
1.421598
> 1.60472 1.73864 2.165805 2.055096 2.158904
> 1.475149 1.518513 1.39441 0.931235 0 0.206013 1.330289
1.397389
> 1.580511 1.714431 2.141596 2.030887 2.134695
> 1.513886 1.55725 1.433147 0.969972 0.206013 0 1.369026
1.436126
> 1.619248 1.753168 2.180333 2.069624 2.173432
> 1.608816 1.65218 1.528077 1.354498 1.330289 1.369026 0
0.604972
> 1.537696 1.671616 2.098781 1.988072 2.09188
> 1.675916 1.71928 1.595177 1.421598 1.397389 1.436126 0.604972
0
> 1.604796 1.738716 2.165881 2.055172 2.15898
> 1.859038 1.902402 1.778299 1.60472 1.580511 1.619248 1.537696
1.
> 604796 0 1.09121 1.968427 1.857718 1.961526
> 1.992958 2.036322 1.912219 1.73864 1.714431 1.753168 1.671616
1.
> 738716 1.09121 0 2.102347 1.991638 2.095446
> 2.420123 2.463487 2.339384 2.165805 2.141596 2.180333 2.098781
> 2.165881 1.968427 2.102347 0 1.128701 1.232509
> 2.309414 2.352778 2.228675 2.055096 2.030887 2.069624 1.988072
> 2.055172 1.857718 1.991638 1.128701 0 0.91546
> 2.413222 2.456586 2.332483 2.158904 2.134695 2.173432 2.09188
2.
> 15898 1.961526 2.095446 1.232509 0.91546 0
> 1 -0.046373 -0.033044 0.003902 0.466827 0.389327 0.131989
-0.
> 063346 -0.118093 0.016386 -0.140215 0.34511 0.233074
> -0.046373 1 0.000717 0.832227 0.077053 -0.106815 -0.050838
0.
> 936431 0.297387 0.031358 -0.127265 0.31245 -0.053169
> -0.033044 0.000717 1 0.011265 -0.018602 -0.023669 -0.028744
-0.
> 007588 0.148827 -0.007067 0.005362 -0.029172 -0.017367
> 0.003902 0.832227 0.011265 1 0.071247 -0.101225 0.097117 0.
> 829167 0.294396 0.017809 -0.129199 0.278831 -0.106427
> 0.466827 0.077053 -0.018602 0.071247 1 0.078241 0.140679 0.
> 070069 0.055744 0.013194 -0.196092 -0.027692 0.028857
> 0.389327 -0.106815 -0.023669 -0.101225 0.078241 1 0.140146
-0.
> 086806 0.079 0.194904 0.068378 0.213288 0.194006
> 0.131989 -0.050838 -0.028744 0.097117 0.140679 0.140146 1
-0.
> 075079 0.137652 0.065127 -0.072768 -0.120751 -0.101777
> -0.063346 0.936431 -0.007588 0.829167 0.070069 -0.086806
-0.075079
> 1 0.312154 0.023108 -0.122502 0.331402 -0.042298
> -0.118093 0.297387 0.148827 0.294396 0.055744 0.079 0.137652
0.
> 312154 1 0.300515 -0.178301 0.033663 -0.057139
> 0.016386 0.031358 -0.007067 0.017809 0.013194 0.194904
0.065127
> 0.023108 0.300515 1 -0.096451 0.033663 -0.039394
> -0.140215 -0.127265 0.005362 -0.129199 -0.196092 0.068378 -0.
> 072768 -0.122502 -0.178301 -0.096451 1 -0.01748 0.253667
> 0.34511 0.31245 -0.029172 0.278831 -0.027692 0.213288
-0.120751
> 0.331402 0.033663 0.033663 -0.01748 1 0.201202
> 0.233074 -0.053169 -0.017367 -0.106427 0.028857 0.194006
-0.101777
> -0.042298 -0.057139 -0.039394 0.253667 0.201202 1
> 0 1.936157 2.266211 3.072091 3.273938 3.486342
> 1.936157 0 2.174716 2.980596 3.182443 3.394847
> 2.266211 2.174716 0 2.935008 3.136855 3.349259
> 3.072091 2.980596 2.935008 0 1.888593 2.100997
> 3.273938 3.182443 3.136855 1.888593 0 1.383438
> 3.486342 3.394847 3.349259 2.100997 1.383438 0
> 1 0.179826 -0.009544 -0.3113 0.149974 -0.204895
> 0.179826 1 0.100759 0.276355 0.098351 0.221849
> -0.009544 0.100759 1 -0.128468 0.032579 -0.212893
> -0.3113 0.276355 -0.128468 1 -0.118107 0.780792
> 0.149974 0.098351 0.032579 -0.118107 1 -0.120811
> -0.204895 0.221849 -0.212893 0.780792 -0.120811 1
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list