Skip to content

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

3 messages · matthewbk, R. Michael Weylandt

#
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])
...

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




--
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.
#
On Wed, Aug 1, 2012 at 11:40 AM, matthewbk <matthew_bk8 at hotmail.com> wrote:
Certainly no "b" ?
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