[R] reading data rows
Ko-Kang Kevin Wang
kwan022 at stat.auckland.ac.nz
Thu Nov 20 20:08:25 CET 2003
Hi,
On Thu, 20 Nov 2003, forkusam wrote:
> to carry out mathematical calculations
>
> I have a a file of the form
> mu1 mu2 alpha beta Wsigma sigmaA b r
> 25 15 .05 .05 22 3 .3 .5
> 30 20 .1 .2 22 .3 .3 .5
>
> I intend to read one row , carry out the calculations
> and then the next row with which I intend to do the
> same calculations.
> I do the following.
> p<-read.table(file="eingabe.csv", header=TRUE,sep=";")
>
> data.frame(as.numeric(mu1<-p$mu1),as.numeric(mu2<-p$mu2),
>
> as.numeric(alpha<-p$alpha),as.numeric(beta<-p$beta),
>
> as.numeric(Wsigma<-p$Wsigma),as.numeric(sigmaA<-p$sigmaA),as.numeric(b<-p$b),as.numeric(r<-p$r))
Is there any particular reason why you want to do this data.frame() line?
To me it seems redundant. Each column is already in numeric/vector form,
I believe.
> Error in uniroot(function(n) eval(p.body) - power,
> c(2, 1e+07)) :
> invalid function value in 'zeroin'
> In addition: Warning message:
> the condition has length > 1 and only the first
> element will be used in: if (f(lower, ...) * f(upper,
> ...) >= 0) stop("f() values at end points not of
> opposite sign")
What kind of mathematical calculations were you trying to do when you got
this error message? As discussed off-list last night, since you want to
operate on each row using the same operation, have you tried using
apply()?
--
Cheers,
Kevin
---------------------------------------------------------------
"Try not. Do, do! Or do not. There is no try"
Jedi Master Yoda
----
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)
More information about the R-help
mailing list