[R] diag() problem
Robin Hankin
r.hankin at noc.soton.ac.uk
Wed Oct 19 16:55:20 CEST 2005
Hi
I have a matrix "u", for which diag() gives an error:
u <- structure(c(5.42334674128216, -2.31319389204264, -5.83059042218476,
-1.64112369640695, -2.31319389212801, 3.22737617646609,
1.85200668021569,
-0.57102273078531, -5.83059042231881, 1.85200668008156,
11.9488923894962,
-3.5525537165941, -1.64112369587405, -0.571022730886046,
-3.55255371755604,
10.0989829379577), .Dim = c(4, 4), .Dimnames = list(c("constant",
NA, NA, NA), c("constant", NA, NA, NA)))
> u
constant <NA> <NA> <NA>
constant 5.423347 -2.3131939 -5.830590 -1.6411237
<NA> -2.313194 3.2273762 1.852007 -0.5710227
<NA> -5.830590 1.8520067 11.948892 -3.5525537
<NA> -1.641124 -0.5710227 -3.552554 10.0989829
> is.matrix(u)
[1] TRUE
> diag(u)
Error in if (is.list(nms) && !any(sapply(nms, is.null)) && all((nm <-
nms[[1]][1:m]) == :
missing value where TRUE/FALSE needed
>
What's going on here?
> R.version
_
platform powerpc-apple-darwin8.2.0
arch powerpc
os darwin8.2.0
system powerpc, darwin8.2.0
status
major 2
minor 2.0
year 2005
month 10
day 06
svn rev 35749
language R
>
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
More information about the R-help
mailing list