[Rd] eigen returns NAs from a real matrix

Martin Maechler maechler at stat.math.ethz.ch
Mon Mar 19 15:15:20 CET 2007


>>>>> "BDR" == Prof Brian Ripley <ripley at stats.ox.ac.uk>
>>>>>     on Mon, 19 Mar 2007 13:37:15 +0000 (GMT) writes:

    BDR> On Mon, 19 Mar 2007, Martin Maechler wrote:
    >>>>>>> "Duncan" == Duncan Murdoch <murdoch at stats.uwo.ca>
    >>>>>>> on Mon, 19 Mar 2007 09:01:39 -0400 writes:
    >> 
    Duncan> On 3/19/2007 6:48 AM, Martin Maechler wrote:
    >> >>>>>>> "BDR" == Prof Brian Ripley <ripley at stats.ox.ac.uk>
    >> >>>>>>> on Sun, 18 Mar 2007 06:51:58 +0000 (GMT) writes:
    >> >>
    BDR> On Sat, 17 Mar 2007, Spencer Graves wrote:
    >> >> >> Hi, All:
    >> >> >> Attached please find a symmetric, indefinite matrix for which
    >> >> >> 'eigen(...)$vectors' included NAs:
    >> >> >>> load("eigenBug.Rdata")
    >> >> >>> sum(is.na(eigen(eigenBug)$vectors))
    >> >> >> [1] 5670
    >> >> >>> sessioninfo()
    >> >> >> Error: could not find function "sessioninfo"
    >> >> >>> sessionInfo()
    >> >> >> R version 2.4.1 (2006-12-18)
    >> >> >> i386-pc-mingw32
    >> >> >>
    >> >> >> locale:
    >> >> >> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
    >> >> >> States.1252;LC_MONETARY=English_United
    >> >> >> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
    >> >> >>
    >> >> >> attached base packages:
    >> >> >> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods" [7]
    >> >> >> "base"
    >> >> >> Using EISPACK does NOT return NAs: > sum(is.na(eigen(eigenBug,
    >> >> >> EISPACK=TRUE)$vectors))
    >> >> >> [1] 0
    >> >> >>
    >> >> >>
    >> >> >> I traced the problem to the following line in 'eigen':
    >> >> >> z <- if (!complex.x)
    >> >> >> .Call("La_rs", x, only.values, PACKAGE = "base")
    >> >> >>
    >> >> >>
    >> >> >> Comments?
    >> >>
    BDR> Nothing appeared as an attachment.
    >> >>
    >> >> it was a zip file which is not among the allowed ones
    >> >> (.tar.gz / *.tgz  would work).
    >> >>
    >> >> Spencer has also contacted me in private,
    >> >> so you now can use something like :
    >> >>
    >> >> F <- tempfile()
    >> >> download.file("ftp://stat.ethz.ch/U/maechler/R/eigenBug.Rdata", F)
    >> >> load(F)
    >> 
    Duncan> This is unrelated to Spencer's problem, but this
    Duncan> sequence failed for me.
    >> 
    Duncan> By default it will treat the file as a text file,
    Duncan> and convert EOL markers for Windows.  Adding
    Duncan> "mode='wb'" to the download.file() call is necessary.
    >> 
    >> ok;  Thank you, Duncan.
    >> 
    >> {For me, that's yet another reason why I think it would be  ``nice''
    >> if both  load() and source()  would work with general
    >> connections the same way as read.table(), and I could just say
    >> 
    >> load("ftp://stat.ethz.ch/U/maechler/R/eigenBug.Rdata")
    >> }

    BDR> The help page for load() does have an example of using a url() connection 
    BDR> here, and that works in this example on Windows, as does

    BDR> load(url("ftp://stat.ethz.ch/U/maechler/R/eigenBug.Rdata"))

    BDR> Not so hard, surely?

definitely not.  Here, I've confused  load() and source() 
and just last week in a course I gave I had wished that I could
use
	source(url(....))

    BDR>   (The reason load() is different is that it can transparently handle compressed files, unlike read.table.)

yes, indeed; I had forgotten about the reason.
Martin



More information about the R-devel mailing list