[R] R_nls_iter error: REAL() can only be applied to a 'numeric', not a 'logical'

R. Michael Weylandt michael.weylandt at gmail.com
Thu Aug 2 00:45:19 CEST 2012


On Wed, Aug 1, 2012 at 11:40 AM, matthewbk <matthew_bk8 at hotmail.com> wrote:
> Hi
>
> I am using the nls function in R however it is causing the following error:
> REAL() can only be applied to a 'numeric', not a 'logical'
>
> Using traceback shows this occurs after the .Call(R_nls_iter, m, ctrl,
> trace) call. However I do not know how to debug this further to find out
> what is causing the error.
>
> The data I give the nls call definitely starts as numeric. The data.frame is
> generated by using the following:
>
> d = data.read('data.csv', header=FALSE)
> x = as.numberic(d[,1])
> y = as.numberic(d[,2])
> z = as.numberic(d[,3])
> ...

Certainly no "b" ?

>
> dat = data.frame(x,y,z...)
>
> nls is started by calling:
> mdl = nls(y ~ Model(x,y,z....,b1,b2,b3), data = dat)
>
> Thanks in advance for any help.
>
> Matthew
>
>

This one's actually tricky since that's an error arising from the C
code. I don't think there's an error in the C code, but let's do some
work on debugging. To start with, can you make a small reproducible
example following the advice given here:

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

To wit, we don't have your "dat" data (use dput! but please, only a
small-ish subset)  nor the function "Model" and the lines of code
replaced by "..." worry me as well.

Best,
Michael

>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/R-nls-iter-error-REAL-can-only-be-applied-to-a-numeric-not-a-logical-tp4638717.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



More information about the R-help mailing list