[R] read in a matrix, difference between 1.3.1 (Windows) and 1.4.1 (Unix)

Petra Steiner steinep at uni-muenster.de
Tue Apr 30 16:42:56 CEST 2002


After I generated the data anew, I am at least sure that the number of tabs
is ok.
Anyway, there must be something wrong with the data, maybe a meta character:

The data looks like that:
First row

	'	(	)	,	-	...	1920	1932	1939
1940	1945	1956	1960	1979	1982	1984	1985	1987	1988
1989	1990	1992	45	:	Aachen	Abb.	Abbau

etc. etc.

Next rows to the end:

,#die           and by tab separated numbers
zu#.            and by tab separated numbers

maybe # is now forbidden?
The program works for small test data.

Regards,
Petra









On 30 Apr 2002, Peter Dalgaard BSA wrote:

> Date: 30 Apr 2002 15:38:38 +0200
> From: Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk>
> To: Petra Steiner <steinep at uni-muenster.de>
> Cc: petra at uni-muenster.de, r-help at stat.math.ethz.ch
> Subject: Re: [R] read in a matrix,
>      difference between 1.3.1 (Windows) and 1.4.1 (Unix)
>
> Petra Steiner <steinep at uni-muenster.de> writes:
>
> > I am reading in a matrix with ignoring the first line. With the exception of
> > the first column (column names) each value is numeric.
> >
> > Up to now the following worked well, although a bit slow.
> >
> > tabx <-  matrix(scan("myfile", what =
> > "", skip=1, quote = ""), byrow=T, nrow=reihenz, ncol=spaltenz)
> > print(tabx)
> > taby <- apply(tabx[1:reihenz,2:spaltenz], 2, as.numeric)
> > rownames(taby) <- tabx[,1]
> > print(taby)
> >
> > Now, with Version 1.4.1 under Unix, for tabx I get a table with the first line
> > repeated many times. as.numeric is not applicable of course.
> >
> > Maybe read.table would be better? But I have to read a lot of data!
>
> An example of what your data look like would be helpful. Both for
> helping you out and to help fix what sounds like a bug.
>
> --
>    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