[R] Fwd: how to convert non numeric data into numeric?

From: kakul modani <kakulmodani_at_gmail.com>
Date: Mon, 21 Apr 2008 19:46:46 -0700

*@ Mr. Alspach and @ Mr. Winsemius : Thanks for replying.

reqdIRR contains returns in lognormal form.I am trying to estimate parameter for type-1 Gumbel Distribution and fit it into reqdIRR.

If i use sapply its returning me NA values. *
I am having the following error in my function

function(theta,reqdIRR)
{
theta1<-theta[1]
theta2<-theta[2]
n<-length(reqdIRR)
constant<- n*(theta1+theta2)
sum1<-lapply(reqdIRR*exp (theta1),FUN = sum) sum2<-lapply(exp(theta2 - reqdIRR*exp(theta1)),FUN = sum) sum = sum1 + sum2
log.fcn = constant - as.numeric(sum)
result = - log.fcn
return(result)
}

*error : neg.log.gumbel(1,reqdIRR)
Error in sum1 + sum2 : non-numeric argument to binary operator
>

how can i rectify the error?Its really urgent...

*

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 22 Apr 2008 - 02:48:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Apr 2008 - 04:30:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive