[R] Problem passing data into read.table()
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Tue Apr 23 22:04:47 CEST 2002
dmcwilli <dmcwilli at utk.edu> writes:
> Sorry for the delay, only just now got back to it ...
>
> 1. debug() did not help, would not show state of nrows inside read.table()
> 2. fill=T did help, could have dropped the last 2 rows (footer).
>
> By accident I found the problem. read.table() returns a dataframe and the
> result of the calculation of the number of rows has mode "list". Coercing it
> to numeric solves the problem.
Oho. Now why didn't I spot that the first time?..
> # coerce rows calculation to numeric
> row.ctr <-
> as.numeric(grid.layout[4]*grid.layout[5]*grid.layout[6]*grid.layout[7])
However, you're mutiplying data frames there, and there's some amount
of unnecessary bureaucracy it that. Using:
grid.layout[1,4]*...
or
grid.layout[[4]]*...
might be a neater solution.
Or simply:
row.ctr <- prod(grid.layout[1,4:7])
--
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