[R] Using metric scaling

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Oct 11 00:44:06 CEST 1999


Murray Jorgensen <maj at waikato.ac.nz> writes:

> Actually I am reading an output file of a program that I do not have.

Genstat?

> I am using R 0.64.2 under Windows 95. I soon found out that read.fwf()
> requires Perl, which I did not have installed. So I downloaded ActivePerl
> from http://www.activestate.com/ActivePerl/ and installed it, as well as 
> DCOM for Windows 95 (required for Windows 95 machines only) - downloadable
> from http://www.microsoft.com/com/dcom/dcom95/dcom1_3.asp. 
> 
> The install was straightforward (I put DCOM on first, which seemed
> logical). However I still have trouble with read.fwf(). At first I thought
> that it was due to spaces in my directory names, but it persisted after I
> fixed this up. My complete session follows:
> 
> [Previously saved workspace restored]
> 
> > t1 <- read.fwf("d:/maj/consulting/Mark Stevens/matrix.txt", width=c(4,
> 22, rep(7, 8)))
> Error: "scan" can't open file
> > t1 <- read.fwf("d:/maj/consulting/MarkStevens/matrix.txt", width=c(4, 22,
> rep(7, 8)))
> Error: "scan" can't open file
> > ss  <- scan("d:/maj/consulting/MarkStevens/matrix.txt")
> Error: "scan" expected a real got "AWANUI"

read.fwf creates a temporary file, and that's probably the one that
scan cannot find. Try debug(read.fwf), singlestep it, list the value
of FILE defined inside of it and see whether the system call creates
that file and whether its content is anywhere near what you'd
expect...

I suspect that the Perl setup got botched somehow, but since I have no
experience with that under Windows I'll leave it for others to
investigate. No chance of getting you on a decent operating system, I
suppose? 

One thing, though: if you pad the triangular blocks with missing value
indicators (e.g. '.'s), read.table(...,na.strings='.') should be able
to read the stuff as an Nx8 (well, 9, counting the names) matrix.
That'll be, lets see, ~200 dots for you to fill in by hand, which
should be manageable by hand without driving you any more "dotty" than
the rest of the ordeal...

Once you got it in, define a function(i,j) which extract x[i,j] from
whereever it has ended up in your data matrix, and do an

outer(1:38,1:38, f)

(which I suppose was Brians idea too, but I seem to have missed his note).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list