[R] how to convert non numeric data into numeric?
PAlspach at hortresearch.co.nz
Tue Apr 22 04:07:37 CEST 2008
lapply() returns a list - as stated in the help file (in general, the
help files and documentation provided with R are very good once one gets
used to them). Lists are, potentially, complex things and it makes no
sense to add them. Presumably in your case it does make sense to add
them - in which case you must first coerce them into another form, or
use a function other than lapply() in the first place. Which might be
the better option depends upon the nature of reqdIRR.
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of kakul modani
> Sent: Tuesday, 22 April 2008 1:41 p.m.
> To: r-help at r-project.org
> Subject: [R] how to convert non numeric data into numeric?
> I am having the following error in my function
> 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
> *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
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
The contents of this e-mail are privileged and/or confidential to the named
recipient and are not to be used by any other person and/or organisation.
If you have received this e-mail in error, please notify the sender and delete
all material pertaining to this e-mail.
More information about the R-help